芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/www/status.pulsehost.co.uk/app/core/Cache.php
PRODUCT_KEY, 'path' => UPLOADS_PATH . 'cache', 'preventCacheSlams' => true, 'cacheSlamsTimeout' => 20, 'secureFileManipulation' => true ]); } else { $config = new \Phpfastcache\Config\Config([ 'path' => UPLOADS_PATH . 'cache', ]); } \Phpfastcache\CacheManager::setDefaultConfig($config); self::$adapter = \Phpfastcache\CacheManager::getInstance($driver); } public static function cache_function_result($key, $tag, $function_to_cache, $cached_seconds = CACHE_DEFAULT_SECONDS) { /* Try to check if the user posts exists via the cache */ $cache_instance = cache()->getItem($key); /* Set cache if not existing */ if(is_null($cache_instance->get())) { $result = $function_to_cache(); $cache_item = $cache_instance->set($result)->expiresAfter($cached_seconds); if($tag) { if(is_array($tag)) { foreach($tag as $tag_key) $cache_item->addTag($tag_key); } else { $cache_item->addTag($tag); } } cache()->save($cache_item); } else { /* Get cache */ $result = $cache_instance->get(); } return $result; } }