10000 [HttpFoundation] MongoDbSessionHandler supports auto expiry via configurable expiry_field by catchamonkey · Pull Request #11510 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[HttpFoundation] MongoDbSessionHandler supports auto expiry via configurable expiry_field #11510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Return early from the gc method when expiry indexes are used
  • Loading branch information
catchamonkey committed Aug 1, 2014
commit 2f8742ea2393f3557407318ac197b9f350aede59
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ public function gc($maxlifetime)
*
* See: http://docs.mongodb.org/manual/tutorial/expire-data/
*/
if (false === $this->options['expiry_field']) {
$time = new \MongoDate(time() - $maxlifetime);

$this->getCollection()->remove(array(
$this->options['time_field'] => array('$lt' => $time),
));

if (false !== $this->options['expiry_field']) {
return true;
}
$time = new \MongoDate(time() - $maxlifetime);

$this->getCollection()->remove(array(
$this->options['time_field'] => array('$lt' => $time),
));

return true;
}
Expand Down
0