当前位置: 首页>>代码示例>>PHP>>正文


PHP wfConfig::diskCacheDisabled方法代码示例

本文整理汇总了PHP中wfConfig::diskCacheDisabled方法的典型用法代码示例。如果您正苦于以下问题:PHP wfConfig::diskCacheDisabled方法的具体用法?PHP wfConfig::diskCacheDisabled怎么用?PHP wfConfig::diskCacheDisabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wfConfig的用法示例。


在下文中一共展示了wfConfig::diskCacheDisabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadFromDiskCache

 public static function loadFromDiskCache($key)
 {
     if (!self::$diskCacheDisabled) {
         if (isset(wfConfig::$diskCache[$key])) {
             return wfConfig::$diskCache[$key];
         }
         $cacheFile = self::getCacheFile();
         if (is_file($cacheFile)) {
             //require($cacheFile); //will only require the file on first parse through this code. But we dynamically update the var and update the file with each get
             try {
                 $cont = @file_get_contents($cacheFile);
                 if (strpos($cont, '<?php') === 0) {
                     //"<?php die() XX"
                     $cont = substr($cont, strlen(self::$tmpFileHeader));
                     wfConfig::$diskCache = @unserialize($cont);
                     if (isset(wfConfig::$diskCache) && is_array(wfConfig::$diskCache) && isset(wfConfig::$diskCache[$key])) {
                         return wfConfig::$diskCache[$key];
                     }
                 }
                 //Else don't return a cached value because this is an old file without the php header so we're going to rewrite it.
             } catch (Exception $err) {
             }
             //file_get or unserialize may fail, so just fail quietly.
         }
     }
     $val = self::getDB()->querySingle("select val from " . self::table() . " where name='%s'", $key);
     if (self::$diskCacheDisabled) {
         return $val;
     }
     wfConfig::$diskCache[$key] = isset($val) ? $val : '';
     try {
         $bytesWritten = @file_put_contents($cacheFile, self::$tmpFileHeader . serialize(wfConfig::$diskCache), LOCK_EX);
     } catch (Exception $err2) {
     }
     if (!$bytesWritten) {
         self::$diskCacheDisabled = true;
     }
     return $val;
 }
开发者ID:HandsomeDogStudio,项目名称:peanutbutterplan,代码行数:39,代码来源:wfConfig.php

示例2: loadFromDiskCache

 public static function loadFromDiskCache($key)
 {
     if (!self::$diskCacheDisabled) {
         if (isset(wfConfig::$diskCache[$key])) {
             return wfConfig::$diskCache[$key];
         }
         $cacheFile = self::getCacheFile();
         if (is_file($cacheFile)) {
             //require($cacheFile); //will only require the file on first parse through this code. But we dynamically update the var and update the file with each get
             try {
                 wfConfig::$diskCache = @unserialize(@file_get_contents($cacheFile));
                 if (isset(wfConfig::$diskCache) && is_array(wfConfig::$diskCache) && isset(wfConfig::$diskCache[$key])) {
                     return wfConfig::$diskCache[$key];
                 }
             } catch (Exception $err) {
             }
             //file_get or unserialize may fail, so just fail quietly.
         }
     }
     $val = self::getDB()->querySingle("select val from " . self::table() . " where name='%s'", $key);
     if (self::$diskCacheDisabled) {
         return $val;
     }
     wfConfig::$diskCache[$key] = isset($val) ? $val : '';
     try {
         $bytesWritten = @file_put_contents($cacheFile, serialize(wfConfig::$diskCache), LOCK_EX);
     } catch (Exception $err2) {
     }
     if (!$bytesWritten) {
         self::$diskCacheDisabled = true;
     }
     return $val;
 }
开发者ID:roycocup,项目名称:enclothed,代码行数:33,代码来源:wfConfig.php


注:本文中的wfConfig::diskCacheDisabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。