\google\appengine\ext\session\MemcacheSessionHandler

FINAL

A session handler interface using the GAE Memcache API.

Implements

]

Constants

SESSION_PREFIX

Methods

__construct

__construct(\google\appengine\ext\session\MemcacheContainer $memcacheContainer = null)

Constructs the session handler instance.

Parameters

Name Description

$memcacheContainer

\google\appengine\ext\session\MemcacheContainer

Optional, for mocking in tests

open

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

Opens the session handler.

Parameters

Name Description

$savePath

string

Not used

$sessionName

string

Not ued

Returns

boolean

true if successful, false otherwise

close

close() : boolean

Closes the session handler.

Returns

boolean

true if successful, false otherwise

read

read(string $id) : string

Read an element from Memcache with the given ID.

Parameters

Name Description

$id

string

Session ID associated with the data to be retrieved

Returns

string

data associated with that ID or bool false on failure

write

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

Write an element to Memcache with the given ID and data.

Parameters

Name Description

$id

string

Session ID associated with the data to be stored

$data

string

Data to be stored

Returns

boolean

true if successful, false otherwise

destroy

destroy(string $id) : boolean

Destroy the data associated with a particular session ID.

Parameters

Name Description

$id

string

Session ID associated with the data to be destroyed

Returns

boolean

true if successful, false otherwise

gc

gc(integer $maxlifetime) : boolean

Garbage collection method - always returns true as this is handled by the Memcache expire function.

Parameters

Name Description

$maxlifetime

integer

Not used

Returns

boolean

true if successful, false otherwise

configure

STATIC   

configure(\google\appengine\ext\session\MemcacheContainer $memcacheContainer = null)

Configure the session handler to use the Memcache API.

Parameters

Name Description

$memcacheContainer

\google\appengine\ext\session\MemcacheContainer

Optional, for mocking in tests