MongoDB session save handler

 Methods

Constructor

__construct(\Mongo | \Zend\Session\SaveHandler\MongoClient $mongo, \Zend\Session\SaveHandler\MongoDBOptions $options) 

Parameters

$mongo

\Mongo\Zend\Session\SaveHandler\MongoClient

Exceptions

\Zend\Session\SaveHandler\Zend\Session\Exception\InvalidArgumentException

Close session

close() : boolean

Returns

boolean

Destroy session

destroy(string $id) : boolean

Parameters

$id

string

Returns

boolean

Garbage collection

gc(int $maxlifetime) : boolean

Note: MongoDB 2.2+ supports TTL collections, which may be used in place of this method by indexing the "modified" field with an "expireAfterSeconds" option. Regardless of whether TTL collections are used, consider indexing this field to make the remove query more efficient.

see \Zend\Session\SaveHandler\http://docs.mongodb.org/manual/tutorial/expire-data/

Parameters

$maxlifetime

int

Returns

boolean

Open session

open(string $savePath, string $name) : boolean

Parameters

$savePath

string

$name

string

Returns

boolean

Read session data

read(string $id) : string

Parameters

$id

string

Returns

string

Write session data

write(string $id, string $data) : boolean

Parameters

$id

string

$data

string

Returns

boolean

 Properties

 

Session lifetime

$lifetime : int

 

MongoCollection instance

$mongoCollection : \Zend\Session\SaveHandler\MongoCollection

 

MongoDB session save handler options

$options : \Zend\Session\SaveHandler\MongoDBOptions

 

Session name

$sessionName : string