public function MemcacheSessionHandler::__construct

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

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php, line 48

Class

MemcacheSessionHandler
MemcacheSessionHandler.

Namespace

Symfony\Component\HttpFoundation\Session\Storage\Handler

Code

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