2

I'm playing around with keeping sessions in the database and I'm new to this. The method in ZF makes it create id's in the database beautifully, however I don't see the database deleting any sessions once they're made, even though I'm setting the lifetime to 20 seconds.

Is the database supposed to delete them itself, or is it up to me? or is it a setup I must do? Thank you!

1
  • The database will not delete them automatically (it has no notion of a "timeout" or how to process it). The framework itself should work twofold: 1) It should not accept an expired session, even if there is a database entry 2) It should provide a mechanism for periodically purging session information from the database. Hopefully these are covered in the ZF documentation. Commented Mar 11, 2012 at 6:29

1 Answer 1

2

it looks like the destroy() method of Zend_Session_SaveHandler_dbTable might be what you're looking for assuming you're using Zend_Session_SaveHandler_dbTable to save your sessions.

Here is the method definition:

public function destroy($id) { $return = false; if ($this->delete($this->_getPrimary($id, self::PRIMARY_TYPE_WHERECLAUSE))) { $return = true; } return $return; } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.