MongoDB session save handler

package Default

 Methods

Constructor

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

Parameters

$mongo

\Mongo\Zend\Session\SaveHandler\MongoClient

$options

\Zend\Session\SaveHandler\MongoDBOptions

Exceptions

\Zend\Session\Exception\InvalidArgumentException

Close session

close() : boolean
inherited_from \Zend\Session\SaveHandler\SaveHandlerInterface::close()

Returns

boolean

Destroy session

destroy(string $id) : boolean
inherited_from \Zend\Session\SaveHandler\SaveHandlerInterface::destroy()

Parameters

$id

string

Returns

boolean

Garbage collection

gc(integer $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
inherited_from \Zend\Session\SaveHandler\SaveHandlerInterface::gc()

Parameters

$maxlifetime

integer

Returns

boolean

Open session

open(string $savePath, string $name) : boolean
inherited_from \Zend\Session\SaveHandler\SaveHandlerInterface::open()

Parameters

$savePath

string

$name

string

Returns

boolean

Read session data

read(string $id) : string
inherited_from \Zend\Session\SaveHandler\SaveHandlerInterface::read()

Parameters

$id

string

Returns

string

Write session data

write(string $id, string $data) : boolean
inherited_from \Zend\Session\SaveHandler\SaveHandlerInterface::write()

Parameters

$id

string

$data

string

Returns

boolean

 Properties

 

Session lifetime

$lifetime : integer

Default

 

MongoCollection instance

$mongoCollection : \Zend\Session\SaveHandler\MongoCollection

Default

 

MongoDB session save handler options

$options : \Zend\Session\SaveHandler\MongoDBOptions

Default

 

Session name

$sessionName : string

Default