/** * Constructor * * @param null|array|Traversable|DbaOptions $options * @throws Exception\ExceptionInterface */ public function __construct($options = null) { if (!extension_loaded('dba')) { throw new Exception\ExtensionNotLoadedException('Missing ext/dba'); } parent::__construct($options); }
/** * @param null $options */ public function __construct($options = null) { parent::__construct($options); // reset initialized flag on update option(s) $initialized =& $this->initialized; $this->getEventManager()->attach('option', function ($event) use(&$initialized) { $initialized = false; }); }
/** * Constructor * * @param null|array|Traversable|ApcuOptions $options * @throws Exception\ExceptionInterface */ public function __construct($options = null) { if (version_compare(phpversion('apcu'), '5.1.0', '<')) { throw new Exception\ExtensionNotLoadedException('Missing ext/apcu >= 5.1.0'); } if (!ini_get('apc.enabled') || PHP_SAPI === 'cli' && !ini_get('apc.enable_cli')) { throw new Exception\ExtensionNotLoadedException("ext/apcu is disabled - see 'apc.enabled' and 'apc.enable_cli'"); } parent::__construct($options); }
/** * {@inheritDoc} * * @throws Exception\ExtensionNotLoadedException */ public function __construct($options = null) { if (!class_exists('Mongo') || !class_exists('MongoClient')) { throw new Exception\ExtensionNotLoadedException('MongoDb extension not loaded or Mongo polyfill not included'); } parent::__construct($options); $initialized =& $this->initialized; $this->getEventManager()->attach('option', function () use(&$initialized) { $initialized = false; }); }
/** * Constructor * * @param null|array|Traversable|MemcachedOptions $options * @throws Exception\ExceptionInterface */ public function __construct($options = null) { if (static::$extMemcachedMajorVersion === null) { $v = (string) phpversion('memcached'); static::$extMemcachedMajorVersion = $v !== '' ? (int) $v[0] : 0; } if (static::$extMemcachedMajorVersion < 1) { throw new Exception\ExtensionNotLoadedException('Need ext/memcached version >= 1.0.0'); } parent::__construct($options); }
/** * Constructor * * @param null|array|Traversable|ApcOptions $options * @throws Exception\ExceptionInterface */ public function __construct($options = null) { $enabled = ini_get('apc.enabled'); if (PHP_SAPI == 'cli') { $enabled = $enabled && (bool) ini_get('apc.enable_cli'); } if (!$enabled) { throw new Exception\ExtensionNotLoadedException("ext/apc is disabled - see 'apc.enabled' and 'apc.enable_cli'"); } parent::__construct($options); }
/** * Constructor * * @param null|array|Traversable|MemcachedOptions $options * @throws Exception\ExceptionInterface */ public function __construct($options = null) { if (phpversion('memcached') < 1) { throw new Exception\ExtensionNotLoadedException('Need ext/memcached version >= 1.0.0'); } parent::__construct($options); // reset initialized flag on update option(s) $initialized =& $this->initialized; $this->getEventManager()->attach('option', function () use(&$initialized) { $initialized = false; }); }
/** * Constructor * * @param null|array|Traversable|MemcachedOptions $options * @throws Exception\ExceptionInterface * @return void */ public function __construct($options = null) { if (static::$extMemcachedMajorVersion === null) { $v = (string) phpversion('memcached'); static::$extMemcachedMajorVersion = ($v !== '') ? (int)$v[0] : 0; } if (static::$extMemcachedMajorVersion < 1) { throw new Exception\ExtensionNotLoadedException('Need ext/memcached version >= 1.0.0'); } parent::__construct($options); // It's ok to init the memcached instance as soon as possible because // ext/memcached auto-connects to the server on first use $this->memcached = new MemcachedResource(); $options = $this->getOptions(); // set lib options if (static::$extMemcachedMajorVersion > 1) { $this->memcached->setOptions($options->getLibOptions()); } else { foreach ($options->getLibOptions() as $k => $v) { $this->memcached->setOption($k, $v); } } $servers = $options->getServers(); if (!$servers) { $options->addServer('127.0.0.1', 11211); $servers = $options->getServers(); } $this->memcached->addServers($servers); // get notified on change options $memc = $this->memcached; $memcMV = static::$extMemcachedMajorVersion; $this->events()->attach('option', function ($event) use ($memc, $memcMV) { $params = $event->getParams(); if (isset($params['lib_options'])) { if ($memcMV > 1) { $memc->setOptions($params['lib_options']); } else { foreach ($params['lib_options'] as $k => $v) { $memc->setOption($k, $v); } } } // TODO: update on change/add server(s) }); }
/** * Constructor * * @param null|array|Traversable|MemcacheOptions $options * @throws Exception\ExceptionInterface */ public function __construct($options = null) { if (version_compare('2.0.0', phpversion('memcache')) > 0) { throw new Exception\ExtensionNotLoadedException("Missing ext/memcache version >= 2.0.0"); } parent::__construct($options); // reset initialized flag on update option(s) $initialized =& $this->initialized; $this->getEventManager()->attach('option', function () use(&$initialized) { $initialized = false; }); }
/** * Create new Adapter for redis storage * * @param null|array|Traversable|RedisArrayOptions $options * @see \Zend\Cache\Storage\Adapter\Abstract */ public function __construct($options = null) { if (!extension_loaded('redis')) { throw new Exception\ExtensionNotLoadedException("Redis extension is not loaded"); } parent::__construct($options); // reset initialized flag on update option(s) $initialized =& $this->initialized; $this->getEventManager()->attach('option', function ($event) use(&$initialized) { $initialized = false; }); }
/** * Constructor * * @param null|array|Traversable|XCacheOptions $options * @throws Exception\ExceptionInterface */ public function __construct($options = null) { if (!extension_loaded('xcache')) { throw new Exception\ExtensionNotLoadedException('Missing ext/xcache'); } if (PHP_SAPI == 'cli') { throw new Exception\ExtensionNotLoadedException("ext/xcache isn't available on SAPI 'cli'"); } if (ini_get('xcache.var_size') <= 0) { throw new Exception\ExtensionNotLoadedException("ext/xcache is disabled - see 'xcache.var_size'"); } parent::__construct($options); }
/** * Constructor * * @param null|array|Traversable|ApcOptions $options * @throws Exception\ExceptionInterface */ public function __construct($options = null) { if (version_compare('3.1.6', phpversion('apc')) > 0) { throw new Exception\ExtensionNotLoadedException("Missing ext/apc >= 3.1.6"); } $enabled = ini_get('apc.enabled'); if (PHP_SAPI == 'cli') { $enabled = $enabled && (bool) ini_get('apc.enable_cli'); } if (!$enabled) { throw new Exception\ExtensionNotLoadedException("ext/apc is disabled - see 'apc.enabled' and 'apc.enable_cli'"); } parent::__construct($options); }
/** * Constructor * * @param array|Traversable|WinCacheOptions $options * @throws Exception\ExceptionInterface */ public function __construct($options = null) { if (!extension_loaded('wincache')) { throw new Exception\ExtensionNotLoadedException("WinCache extension is not loaded"); } $enabled = ini_get('wincache.ucenabled'); if (PHP_SAPI == 'cli') { $enabled = $enabled && (bool) ini_get('wincache.enablecli'); } if (!$enabled) { throw new Exception\ExtensionNotLoadedException("WinCache is disabled - see 'wincache.ucenabled' and 'wincache.enablecli'"); } parent::__construct($options); }
/** * Constructor * * @param null|array|Traversable|MemcachedOptions $options * @throws Exception\ExceptionInterface */ public function __construct($options = null) { if (static::$extMemcachedMajorVersion === null) { $v = (string) phpversion('memcached'); static::$extMemcachedMajorVersion = $v !== '' ? (int) $v[0] : 0; } if (static::$extMemcachedMajorVersion < 1) { throw new Exception\ExtensionNotLoadedException('Need ext/memcached version >= 1.0.0'); } parent::__construct($options); // reset initialized flag on update option(s) $initialized =& $this->initialized; $this->getEventManager()->attach('option', function ($event) use(&$initialized) { $initialized = false; }); }
/** * Constructor * * @param null|array|Traversable|MemcachedOptions $options * @throws Exception * @return void */ public function __construct($options = null) { if (static::$extMemcachedMajorVersion === null) { $v = (string) phpversion('memcached'); static::$extMemcachedMajorVersion = $v !== '' ? (int) $v[0] : 0; } if (static::$extMemcachedMajorVersion < 1) { throw new Exception\ExtensionNotLoadedException('Need ext/memcached version >= 1.0.0'); } $this->memcached = new MemcachedResource(); parent::__construct($options); // It's ok to add server as soon as possible because // ext/memcached auto-connects to the server on first use // TODO: Handle multiple servers $options = $this->getOptions(); $this->memcached->addServer($options->getServer(), $options->getPort()); }
/** * Constructor * * @param null|array|Traversable|ApcOptions $options * @throws Exception * @return void */ public function __construct($options = null) { if (version_compare('3.1.6', phpversion('apc')) > 0) { throw new Exception\ExtensionNotLoadedException("Missing ext/apc >= 3.1.6"); } $enabled = ini_get('apc.enabled'); if (PHP_SAPI == 'cli') { $enabled = $enabled && (bool) ini_get('apc.enable_cli'); } if (!$enabled) { throw new Exception\ExtensionNotLoadedException("ext/apc is disabled - see 'apc.enabled' and 'apc.enable_cli'"); } // init select map if (static::$selectMap === null) { static::$selectMap = array('value' => \APC_ITER_VALUE, 'mtime' => \APC_ITER_MTIME, 'ctime' => \APC_ITER_CTIME, 'atime' => \APC_ITER_ATIME, 'rtime' => \APC_ITER_DTIME, 'ttl' => \APC_ITER_TTL, 'num_hits' => \APC_ITER_NUM_HITS, 'ref_count' => \APC_ITER_REFCOUNT, 'mem_size' => \APC_ITER_MEM_SIZE, 'internal_key' => \APC_ITER_KEY); } parent::__construct($options); }
/** * Constructor * * @param array $options * @throws Exception\ExceptionInterface */ public function __construct($options = null) { parent::__construct($options); }
/** * @param string $cacheName Name of the cache being used. Defaults to cache. */ public function __construct($cacheName = 'cache') { parent::__construct(); $this->cacheName = $cacheName; }
/** * {@inheritDoc} * @param Cache $cache */ public function __construct($options, Cache $cache) { parent::__construct($options); $this->cache = $cache; }
/** * @param string $cacheName Name of the cache being used. Defaults to cache. * @param int $cacheLifetime Number of seconds to consider the cache fresh before it expires. */ public function __construct($cacheName = 'cache', $cacheLifetime = null) { parent::__construct(); $this->cacheName = $cacheName; $this->cacheLifetime = $cacheLifetime; }