apcu_cache_info example

return array();
    }

    /** * Return an array of stored cache ids * * @return array array of stored cache ids (string) */
    public function getIds()
    {
        $res = array();
        $array = apcu_cache_info(false);
        $records = $array['cache_list'];
        foreach ($records as $record) {
            $res[] = $record['info'];
        }
        return $res;
    }

    /** * Return an array of metadatas for the given cache id * * The array must include these keys : * - expire : the expire timestamp * - tags : a string array of tags * - mtime : timestamp of last modification time * * @param string $id cache id * @return array array of metadatas (false if the cache id is not found) */
/** * Returns cache information * * @return array */
    public function getConfigCacheInfo()
    {
        $backendCache = $this->cache->getBackend();

        if ($backendCache instanceof Zend_Cache_Backend_Apcu) {
            $info = [];
            $apcInfo = apcu_cache_info('user');
            $info['files'] = $apcInfo['num_entries'];
            $info['size'] = $this->encodeSize($apcInfo['mem_size']);
            $apcInfo = apcu_sma_info();
            $info['freeSpace'] = $this->encodeSize($apcInfo['avail_mem']);
        } elseif ($backendCache instanceof Zend_Cache_Backend_Redis) {
            $info = [];

            /** @var Redis $redis */
            $redis = $backendCache->getRedis();
            $info['files'] = $redis->dbSize();
            $info['size'] = $this->encodeSize($redis->info()['used_memory']);
        }
Home | Imprint | This part of the site doesn't use cookies.