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\Exception\InvalidArgumentException

Close session

close() : bool

Returns

bool

Destroy session

destroy(string $id) : bool

Parameters

$id

string

Returns

bool

Garbage collection

gc(int $maxlifetime) : bool

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

bool

Open session

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

Parameters

$savePath

string

$name

string

Returns

bool

Read session data

read(string $id) : string

Parameters

$id

string

Returns

string

Write session data

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

Parameters

$id

string

$data

string

Returns

bool

 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