public static function getZendCache() { if (!isset(self::$_zendCache)) { $be = self::getBackend(); if ($be == 'elastiCache') { //TODO: use similar like memcache without Zend_Cache self::$_zendCache = new Zend_Cache_Core(array('lifetime' => null, 'write_control' => false, 'automatic_cleaning_factor' => 0, 'automatic_serialization' => true)); self::$_zendCache->setBackend(new Kwf_Util_Aws_ElastiCache_CacheBackend(array('cacheClusterId' => Kwf_Config::getValue('aws.simpleCacheCluster')))); } else { if ($be == 'apc') { self::$_zendCache = false; } else { self::$_zendCache = new Zend_Cache_Core(array('lifetime' => null, 'write_control' => false, 'automatic_cleaning_factor' => 0, 'automatic_serialization' => true)); if ($be == 'memcache') { //not used using Zend_Cache self::$_zendCache = false; } else { self::$_zendCache = false; } } } if (self::$_zendCache) { $be = self::$_zendCache->getBackend(); if ($be instanceof Zend_Cache_Backend_Memcached) { //namespace is incremented in Kwf_Util_ClearCache //use memcache directly as Zend would not save the integer directly and we can't increment it then $v = self::$_zendCache->getBackend()->getMemcache()->get(self::getUniquePrefix() . 'cache_namespace'); if (!$v) { $v = time(); self::$_zendCache->getBackend()->getMemcache()->set(self::getUniquePrefix() . 'cache_namespace', $v); } if ($be instanceof Kwf_Util_Aws_ElastiCache_CacheBackend) { //Kwf_Util_Aws_ElastiCache_CacheBackend doesn't use Kwf_Cache_Backend_Memcached, so we don't have a app prefix //set app prefix ourselves $v = Kwf_Config::getValue('application.id') . Kwf_Setup::getConfigSection() . $v; } self::$_zendCache->setOption('cache_id_prefix', $v); } } } return self::$_zendCache; }
public static function getZendCache() { if (!isset(self::$_zendCache)) { $be = self::getBackend(); if ($be == 'apc' || $be == 'apcu') { self::$_zendCache = false; } else { self::$_zendCache = new Zend_Cache_Core(array('lifetime' => null, 'write_control' => false, 'automatic_cleaning_factor' => 0, 'automatic_serialization' => true)); if ($be == 'memcache') { //not used using Zend_Cache self::$_zendCache = false; } else { self::$_zendCache = false; } } if (self::$_zendCache) { $be = self::$_zendCache->getBackend(); if ($be instanceof Zend_Cache_Backend_Memcached) { self::$_zendCache->setOption('cache_id_prefix', self::_getMemcachePrefix()); } } } return self::$_zendCache; }