/**
  * opening of the session - mandatory arguments won't be needed
  *
  * @param string $savePath
  * @param string $sessionName
  * @return bool
  */
 public function open($savePath, $sessionName)
 {
     if (!isset($this->_lifeTime)) {
         $this->_lifeTime = intval(ini_get("session.gc_maxlifetime"));
     }
     if (!isset($this->_refreshTime)) {
         $this->_refreshTime = ceil($this->_lifeTime / 3);
     }
     $this->_initSessionData = null;
     $this->_memcache = new Memcache();
     if (Kwf_Config::getValue('aws.simpleCacheCluster')) {
         $servers = Kwf_Util_Aws_ElastiCache_CacheClusterEndpoints::getCached(Kwf_Config::getValue('aws.simpleCacheCluster'));
     } else {
         if (Kwf_Cache_Simple::$memcacheHost) {
             $servers = array(array('host' => Kwf_Cache_Simple::$memcacheHost, 'port' => Kwf_Cache_Simple::$memcachePort));
         } else {
             throw new Kwf_Exception("no memcache configured");
         }
     }
     foreach ($servers as $s) {
         if (version_compare(phpversion('memcache'), '2.1.0') == -1 || phpversion('memcache') == '2.2.4') {
             // < 2.1.0
             $this->_memcache->addServer($s['host'], $s['port'], true, 1, 1, 1);
         } else {
             if (version_compare(phpversion('memcache'), '3.0.0') == -1) {
                 // < 3.0.0
                 $this->_memcache->addServer($s['host'], $s['port'], true, 1, 1, 1, true, null, 10000);
             } else {
                 $this->_memcache->addServer($s['host'], $s['port'], true, 1, 1, 1);
             }
         }
     }
     return true;
 }
 public function __construct(array $options = array())
 {
     if (!isset($options['cacheClusterId'])) {
         throw new Kwf_Exception('required parameter: cacheClusterId');
     }
     $options['servers'] = Kwf_Util_Aws_ElastiCache_CacheClusterEndpoints::getCached($options['cacheClusterId']);
     parent::__construct($options);
 }
 public function __construct($config = array())
 {
     if (isset($config['cacheCluster'])) {
         $memcache = new Memcache();
         $servers = Kwf_Util_Aws_ElastiCache_CacheClusterEndpoints::getCached($config['cacheCluster']);
         foreach ($servers as $s) {
             if (version_compare(phpversion('memcache'), '2.1.0') == -1 || phpversion('memcache') == '2.2.4') {
                 // < 2.1.0
                 $memcache->addServer($s['host'], $s['port'], true, 1, 1, 1);
             } else {
                 if (version_compare(phpversion('memcache'), '3.0.0') == -1) {
                     // < 3.0.0
                     $memcache->addServer($s['host'], $s['port'], true, 1, 1, 1, true, null, 10000);
                 } else {
                     $memcache->addServer($s['host'], $s['port'], true, 1, 1, 1);
                 }
             }
         }
         $config['memcache'] = $memcache;
     }
     parent::__construct($config);
 }