Returns the cache persistence.

@return common_persistence_KvDriver
342016
protected function getCachePersistence()
    {
        if (is_null($this->cachePersistence) && $this->hasOption(static::OPTION_CACHE_PERSISTENCE)) {
            $persistenceOption = $this->getOption(static::OPTION_CACHE_PERSISTENCE);
            $this->cachePersistence = (is_object($persistenceOption))
                ? $persistenceOption
                : common_persistence_KeyValuePersistence::getPersistence($persistenceOption);
        }

        return $this->cachePersistence;
    }
410671
private static function driver()
    {
        $options = config('cache.options');

        $driver = config('cache.default');

        switch ($driver) {
            case 'file':
                    return instance(FileDriver::class);
                break;

            case 'apc':
                    return instance(ApcDriver::class);
                break;

            case 'database':
                    return instance(PDODriver::class);
                break;

            default:
                    exception(DriverNotFoundException::class);
                break;
        }
    }
1051928
public function persist()
    {

        $blob = $this->serializer->serialize($this->_attributes, $this->serializeOptions);

        $result = (bool)$this->filesystem->write($this->url, $blob, $this->getOption('file_locking'));

        if (!$hashMethod = $this->getOption('checksum_method')) {
            return $result;
        }

        $checksum = $this->createChecksum($hashMethod, $blob);

        $savedBlob = $this->filesystem->read($this->url);

        $this->checkData($hashMethod, $savedBlob, $checksum);

        return $result;
    }
130117
protected function getDefaultCache()
    {
        if (extension_loaded('apcu')) {
            return new ApcuCachePool();
        }

        if (class_exists('\Cache\Adapter\Filesystem\FilesystemCachePool')) {
            $filesystemAdapter = new Local($this->cacheDir);
            $filesystem        = new Filesystem($filesystemAdapter);
            return new FilesystemCachePool($filesystem);
        }

        return null;
    }
640750
protected function getCurrentKvResultStorage()
    {
        /** @var ResultServerService $resultService */
        $resultService = $this->getServiceLocator()->get(ResultServerService::SERVICE_ID);
        $resultStorageKey = $resultService->getOption(ResultServerService::OPTION_RESULT_STORAGE);
        if ($resultStorageKey != 'taoAltResultStorage/KeyValueResultStorage') {
            throw new \common_Exception('Result storage is not on KeyValue storage mode.');
        }
        return $resultService->instantiateResultStorage($resultStorageKey);
    }
338629
public function getPersistence()
    {
        if (null === $this->persistence) {
            $this->persistence = (isset($this->options['persistence']) && $this->options['persistence'] == true);
        }
        
        return $this->persistence;
    }
721340
public function getCacheTtl()
    {
        if ($this->hasOption(static::OPTION_CACHE_PERSISTENCE_TTL)) {
            $cacheTtl = $this->getOption(static::OPTION_CACHE_PERSISTENCE_TTL);
            if (!is_null($cacheTtl)) {
                return $cacheTtl;
            }
        }

        return static::CACHE_PERSISTENCE_DEFAULT_TTL;
    }
1269214
public function getCache() {
    if (!isset($this->cache))
      $this->cache = new \Doctrine\Common\Cache\ArrayCache;
      
    return $this->cache;
  }
1075254
protected function getCacheKey()
    {
        $target = $this->getSourceObject();
        if (!isset(self::$cacheKeyCache[$target])) {
            self::$cacheKeyCache[$target] = DataList::create($target)->max('LastEdited');
        }
        return self::$cacheKeyCache[$target];
    }
758841
public function getCacheSystem()
    {
        if (is_null($this->cache)) {
            $this->cache = new \Gregwar\Cache\Cache();
            $this->cache->setCacheDirectory($this->cacheDir);
        }

        return $this->cache;
    }
1279022
public function getCacheService()
    {
        $memcached = $this->memcached;
        if (empty($memcached)) {
            /**
             * @var \Zend\Cache\Storage\Adapter\Memcached $memcached
             */
            $memcached = $this->getServiceLocator()->get('memcached');
        }

        return $memcached;
    }
578154
public function getDataCache()
    {
        $key = $this->generateKey();

        return $this->getRepository()->getMongator()->getDataCache()->get($key);
    }
288242
public function getResultCacheDriver()
    {
        if (!$this->resultCacheDriver instanceof CacheProvider) {
            $this->resultCacheDriver = $this->getCacheDriver(
                (string) $this->getOption('result_cache_namespace'),
                $this->getOption('result_cache_driver')
            );
        }

        return $this->resultCacheDriver;
    }
351977
protected function createMemcacheDriver()
    {
        $serverArray    = $this->config['servers'];
        $persistent     = boolval($this->config['persistent']);
        $name           = trim($this->config['server_name']);
        $prefix         = trim($this->config['prefix']);
        $expireTime     = intval($this->config['lifetime']);

        if ($persistent && (strlen($name) > 0)) {
            $memcached  = new Memcached($name);
        } else {
            $memcached  = new Memcached();
        }

        if (!sizeof($memcached->getServerList())) {
            $memcached->addServers($serverArray);
        }

        $store = new MemcachedStore($memcached, $prefix);
        return new CacheSessionHandler($store, $expireTime);
    }
1019442
protected Object getCacheManager() {
        CacheManager cacheManager = CacheManager.getInstance();
        if (cacheManager != null)
            return cacheManager;
        return CacheManager.newInstance();
    }
539060
public function getCacheDir()
    {
        // allows container rebuild when config or version changes
        $hash = Zephir::VERSION.$this->environment.serialize($this->extraConfigFiles);
        $home = getenv('HOME') ?: (getenv('HOMEDRIVE').DIRECTORY_SEPARATOR.getenv('HOMEPATH'));

        if (is_macos()) {
            $cacheDir = getenv('XDG_CACHE_HOME') ?: $home.'/Library/Caches';
            $cacheDir .= '/Zephir';
        } elseif (is_windows()) {
            $cacheDir = getenv('LOCALAPPDATA') ?: $home;
            $cacheDir .= '\\Zephir\\Cache';
        } else {
            $cacheDir = getenv('XDG_CACHE_HOME') ?: $home.'/.cache';
            $cacheDir .= '/zephir';
        }

        $path = $cacheDir.DIRECTORY_SEPARATOR.substr(md5($hash), 0, 16);
        if (!is_dir($path) && !mkdir($path, 0777, true) && !is_dir($path)) {
            throw new \RuntimeException(sprintf('Directory "%s" was not created', $path));
        }

        return $path;
    }
756289
static public function getDefaultCacheHandler() {
        if(!isset(self::$defaultCacheHandler)) {            
            global $container;
            if(self::BACKWORDS_COMPATIBLE && isset($container) && isset($container['memcache'])) {
                // Backwards Compatibility
                if(class_exists("Memcache") && is_a($container['memcache'], "Memcache")) {
                    self::$defaultCacheHandler = new CacheHandler\Memcache($container['memcache']);
                } else if (class_exists("Memcached") && is_a($container['memcache'], "Memcached")) {
                    self::$defaultCacheHandler = new CacheHandler\Memcached($container['memcache']);    
                } else {
                    trigger_error("Before using NoizuLabs/Fragmented you must set a cache handler using NoizuLabs\FragmentedKeys\Configuration::setDefaultCacheHandler(ICacheHandle \$handler) or use only KeyRing entries with a specified storage mechanism.", E_USER_ERROR);    
                }
            }  else {
                trigger_error("Before using NoizuLabs/Fragmented you must set a cache handler using NoizuLabs\FragmentedKeys\Configuration::setDefaultCacheHandler(ICacheHandle \$handler) or use only KeyRing entries with a specified storage mechanism.", E_USER_ERROR);
            }
        }
        return self::$defaultCacheHandler;
    }