Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Allow session garbage collection to use an index #6110

Merged
merged 1 commit into from
Apr 14, 2014
Merged
Changes from all commits
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
5 changes: 2 additions & 3 deletions library/Zend/Session/SaveHandler/DbTableGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,9 @@ public function destroy($id)
public function gc($maxlifetime)
{
$platform = $this->tableGateway->getAdapter()->getPlatform();
return (bool) $this->tableGateway->delete(sprintf('%s + %s < %d',
return (bool) $this->tableGateway->delete(sprintf('%s < %d',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does mysql really not optimize this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I can provide a sql fiddle to prove it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hjr3 it's fine - I was really just wondering why MySQL always manages to disappoint me :D

$platform->quoteIdentifier($this->options->getModifiedColumn()),
$platform->quoteIdentifier($this->options->getLifetimeColumn()),
time()
(time() - $this->lifetime)
));
}
}