You are here

public function MemcachedSessionHandler::__construct in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php \Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandler::__construct()

Constructor.

List of available options:

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

Parameters

\Memcached $memcached A \Memcached instance:

array $options An associative array of Memcached options:

Throws

\InvalidArgumentException When unsupported options are passed

File

vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php, line 53

Class

MemcachedSessionHandler
MemcachedSessionHandler.

Namespace

Symfony\Component\HttpFoundation\Session\Storage\Handler

Code

public function __construct(\Memcached $memcached, array $options = array()) {
  $this->memcached = $memcached;
  if ($diff = array_diff(array_keys($options), array(
    'prefix',
    'expiretime',
  ))) {
    throw new \InvalidArgumentException(sprintf('The following options are not supported "%s"', implode(', ', $diff)));
  }
  $this->ttl = isset($options['expiretime']) ? (int) $options['expiretime'] : 86400;
  $this->prefix = isset($options['prefix']) ? $options['prefix'] : 'sf2s';
}