In PHP 7, session_start() can take an $options array parameter (php doc)
Using this parameter with Cm_RedisSession will cause the read() function to increment the lock field of the redis hash structure, then close() will be immediately called.
Unfortunately, close() does not decrement the lock field, which means that any subsequent call to read() will wait until the configured timeout before taking the lock on the session.
/**
* Overridden to prevent calling getLifeTime at shutdown
*
* @return bool
*/
public function close()
{
$this->_log("Closing connection");
if ($this->_redis) $this->_redis->close();
return true;
}
Submitted PR #17, however, I'm not convinced this is the right way of handling this issue.
It might make more sense to add logic to read() to release the lock when being used with "read_and_close".
In PHP 7,
session_start()can take an$optionsarray parameter (php doc)Using this parameter with
Cm_RedisSessionwill cause theread()function to increment thelockfield of the redis hash structure, thenclose()will be immediately called.Unfortunately,
close()does not decrement thelockfield, which means that any subsequent call toread()will wait until the configured timeout before taking the lock on the session.Submitted PR #17, however, I'm not convinced this is the right way of handling this issue.
It might make more sense to add logic to
read()to release the lock when being used with "read_and_close".