You are here

public function MemcacheSessionHandler::__construct in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php \Symfony\Component\HttpFoundation\Session\Storage\Handler\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

vendor/symfony/http-foundation/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';
}