/** * Does nothing for now (with APC), maybe will do something with memcache */ public function __construct(array $APCOptions = null, array $MemcacheOptions = null) { if ($APCOptions && !empty($APCOptions['Enabled']) && (!ini_get('apc.enabled') || !function_exists('apc_store'))) { throw new Exception('APC not available'); } elseif ($APCOptions) { self::$APCOptions = array_merge(self::$DefaultAPCOptions, $APCOptions); self::$APCOn = !empty(self::$APCOptions['Enabled']); } if ($MemcacheOptions && !empty($MemcacheOptions['Enabled']) && !class_exists('Memcached')) { throw new Exception('Memcached not available (Memcached extension, not Memcache)'); } elseif ($MemcacheOptions) { self::$MemcacheOptions = array_merge(self::$DefaultMemcacheOptions, $MemcacheOptions); self::$MemcacheOn = !empty(self::$MemcacheOptions['Enabled']); self::$Memcache = new Memcached(); if (!empty(self::$MemcacheOptions['Consistent'])) { self::$Memcache->setOptions(array(Memcached::OPT_CONNECT_TIMEOUT => 20, Memcached::OPT_DISTRIBUTION => Memcached::DISTRIBUTION_CONSISTENT, Memcached::OPT_SERVER_FAILURE_LIMIT => 5, Memcached::OPT_REMOVE_FAILED_SERVERS => true, Memcached::OPT_RETRY_TIMEOUT => 1, Memcached::OPT_LIBKETAMA_COMPATIBLE => true)); } $MemcacheServers = self::ParseMemcacheServers(self::$MemcacheOptions['Servers']); self::$Memcache->addServers($MemcacheServers); } }