\Symfony\Component\HttpFoundation\Session\Storage\HandlerMemcacheSessionHandler

MemcacheSessionHandler.

Summary

Methods
Properties
Constants
__construct()
open()
close()
read()
write()
destroy()
gc()
No public properties found
No constants found
getMemcache()
No protected properties found
N/A
No private methods found
$memcache
$ttl
$prefix
N/A

Properties

$memcache

$memcache : \Memcache

Type

\Memcache — Memcache driver.

$ttl

$ttl : integer

Type

integer — Time to live in seconds

$prefix

$prefix : string

Type

string — Key prefix for shared environments.

Methods

__construct()

__construct(\Memcache  $memcache, array  $options = array()) 

Constructor.

List of available options:

  • prefix: The prefix to use for the memcache keys in order to avoid collision
  • expiretime: The time to live in seconds

Parameters

\Memcache $memcache

A \Memcache instance

array $options

An associative array of Memcache options

Throws

\InvalidArgumentException

When unsupported options are passed

open()

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

Re-initializes existing session, or creates a new one.

Parameters

string $savePath

Save path

string $sessionName

Session name, see http://php.net/function.session-name.php

Returns

boolean —

true on success, false on failure

close()

close() : boolean

Closes the current session.

Returns

boolean —

true on success, false on failure

read()

read(string  $sessionId) : string

Reads the session data.

Parameters

string $sessionId

Session ID, see http://php.net/function.session-id

Returns

string —

Same session data as passed in write() or empty string when non-existent or on failure

write()

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

Writes the session data to the storage.

Care, the session ID passed to write() can be different from the one previously received in read() when the session ID changed due to session_regenerate_id().

Parameters

string $sessionId

Session ID , see http://php.net/function.session-id

string $data

Serialized session data to save

Returns

boolean —

true on success, false on failure

destroy()

destroy(string  $sessionId) : boolean

Destroys a session.

Parameters

string $sessionId

Session ID, see http://php.net/function.session-id

Returns

boolean —

true on success, false on failure

gc()

gc(string|integer  $maxlifetime) : boolean

Cleans up expired sessions (garbage collection).

Parameters

string|integer $maxlifetime

Sessions that have not updated for the last maxlifetime seconds will be removed

Returns

boolean —

true on success, false on failure

getMemcache()

getMemcache() : \Memcache

Return a Memcache instance

Returns

\Memcache