public function __construct(array $aConfig = [])
 {
     // Parent construct
     parent::__construct($aConfig);
     // Extend config
     $aConfig = ExtendedArray::extendWithDefaultValues($aConfig, ['connection_timeout' => 10, 'server_failure_limit' => 5, 'remove_failed_servers' => true, 'retry_timeout' => 1]);
     // Check Memcached is loaded
     if (!extension_loaded('memcached')) {
         throw new RuntimeException('Memcached extension is not loaded');
     }
     // Create client
     $this->oClient = new Memcached();
     $this->oClient->setOption(Memcached::OPT_CONNECT_TIMEOUT, $aConfig['connection_timeout']);
     $this->oClient->setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT);
     $this->oClient->setOption(Memcached::OPT_SERVER_FAILURE_LIMIT, $aConfig['server_failure_limit']);
     $this->oClient->setOption(Memcached::OPT_REMOVE_FAILED_SERVERS, $aConfig['remove_failed_servers']);
     $this->oClient->setOption(Memcached::OPT_RETRY_TIMEOUT, $aConfig['retry_timeout']);
     // Add servers
     if (array_key_exists('servers', $aConfig)) {
         $aServers = array_filter(explode(',', $aConfig['servers']));
         foreach ($aServers as $sAddress) {
             // Parse address
             list($sHost, $sPort) = array_pad(explode(':', $sAddress), 2, '');
             // Add server
             $this->oClient->addServer($sHost, intval($sPort));
         }
     }
 }
 public function __construct(array $aConfig = [])
 {
     // Parent construct
     parent::__construct($aConfig);
     // Check APC is loaded
     if (!extension_loaded('apc') && !extension_loaded('apcu')) {
         throw new RuntimeException('APC extension is not loaded');
     }
 }
 public function __construct(array $aConfig = [])
 {
     // Parent construct
     parent::__construct($aConfig);
     // Extend config
     $aConfig = ExtendedArray::extendWithDefaultValues($aConfig, ['timeout' => 0.0]);
     // Check Redis is loaded
     if (!extension_loaded('redis')) {
         throw new RuntimeException('Redis extension is not loaded');
     }
     // Create client
     $this->oClient = new Redis();
     // Add servers
     if (array_key_exists('servers', $aConfig)) {
         $aServers = array_filter(explode(',', $aConfig['servers']));
         foreach ($aServers as $sAddress) {
             // Parse address
             list($sHost, $sPort) = array_pad(explode(':', $sAddress), 2, '');
             // Connect
             $this->oClient->connect($sHost, intval($sPort), $aConfig['timeout']);
         }
     }
 }