本文整理汇总了PHP中static::cache方法的典型用法代码示例。如果您正苦于以下问题:PHP static::cache方法的具体用法?PHP static::cache怎么用?PHP static::cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类static
的用法示例。
在下文中一共展示了static::cache方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCache
/**
* @return SplObjectStorage
*/
protected static function getCache()
{
if (!static::$cache) {
static::$cache = new SplObjectStorage();
}
return static::$cache;
}
示例2: clearCache
public function clearCache()
{
static::$cache = [];
static::$cacheFile = NULL;
$this->initialize();
return $this;
}
示例3: provide
public static function provide()
{
if (!static::$cache) {
static::$cache = static::loadCache();
}
return static::$cache;
}
示例4: useRangeDate
public function useRangeDate()
{
if (static::$cache === null) {
static::$cache = $this->getHandleClassInstance();
}
return static::$cache->useRangeDate();
}
示例5: getConfig
/**
* Get plugin config
*
* @param string $packageName
* @param string $pluginName
* @return Config
*/
public static function getConfig($packageName, $pluginName = null, $ignoreCache = false)
{
if (empty($packageName)) {
throw new InvalidArgumentException("\$packageName is empty");
}
if ($pluginName === null) {
$pluginName = $packageName;
}
if (!is_object(static::$cache)) {
static::$cache = new Config();
}
if (isset(static::$globalConfig->{$packageName}) and isset(static::$globalConfig->{$packageName}->{$pluginName})) {
$globalConfig = static::$globalConfig->{$packageName}->{$pluginName};
} else {
$globalConfig = new Config();
}
if (!$ignoreCache and isset(static::$cache->{$packageName}) and isset(static::$cache->{$packageName}->{$pluginName})) {
return static::mergeConfigs($globalConfig, static::$cache->{$packageName}->{$pluginName});
}
//echo "$packageName - $pluginName<br>\n";
if (file_exists(SITE_PACKAGES_PATH . "{$packageName}/{$pluginName}/DefaultConfig.inc.php")) {
include SITE_PACKAGES_PATH . "{$packageName}/{$pluginName}/DefaultConfig.inc.php";
} elseif (file_exists(STINGLE_PATH . "packages/{$packageName}/{$pluginName}/DefaultConfig.inc.php")) {
include STINGLE_PATH . "packages/{$packageName}/{$pluginName}/DefaultConfig.inc.php";
} else {
$defaultConfig = array();
}
$defaultConfigObj = new Config($defaultConfig);
$result = static::mergeConfigs($globalConfig, $defaultConfigObj);
if (!isset(static::$cache->{$packageName})) {
static::$cache->{$packageName} = new Config();
}
static::$cache->{$packageName}->{$pluginName} = $defaultConfigObj;
return $result;
}
示例6: cache
/**
* @return \metalguardian\fileProcessor\components\ThumbnailCache
* @throws \yii\base\InvalidConfigException
*/
public static function cache()
{
if (is_null(static::$cache)) {
static::$cache = \Yii::createObject(\metalguardian\fileProcessor\components\ThumbnailCache::className());
}
return static::$cache;
}
示例7: setInstance
public static function setInstance($dir = null)
{
$dir = $dir ? $dir : "myAppDirCache";
static::$file_cache_dir = sfConfig::get('sf_cache_dir') . DIRECTORY_SEPARATOR . $dir;
static::$cache = new sfFileCache(array('cache_dir' => static::$file_cache_dir));
return static::$cache;
}
示例8: init
/**
* Should be called in beforeRender()
*
*/
public static function init(View $View)
{
$params = $View->request->params;
if (Configure::read('UrlCache.pageFiles')) {
$cachePageKey = '_misc';
if (is_object($View)) {
$path = $View->request->here;
if ($path === '/') {
$path = 'uc_homepage';
} else {
$path = strtolower(Inflector::slug($path));
}
if (empty($path)) {
$path = 'uc_error';
}
$cachePageKey = '_' . $path;
}
static::$cachePageKey = static::$cacheKey . $cachePageKey;
static::$cachePage = Cache::read(static::$cachePageKey, '_cake_core_');
}
static::$cache = Cache::read(static::$cacheKey, '_cake_core_');
// still old "prefix true/false" syntax?
if (Configure::read('UrlCache.verbosePrefixes')) {
unset(static::$paramFields[3]);
static::$paramFields = array_merge(static::$paramFields, (array) Configure::read('Routing.prefixes'));
}
static::$extras = array_intersect_key($params, array_combine(static::$paramFields, static::$paramFields));
$defaults = array();
foreach (static::$paramFields as $field) {
$defaults[$field] = '';
}
static::$extras = array_merge($defaults, static::$extras);
}
示例9: setCustomCache
/**
* Use a custom fCache object to serve caches. Any fCache object works, so if the directory
* cache isn't working well, developers should test different cache options and find one that
* works best.
*
* @param fCache $cache The fCache object to serve as a cache
*/
public static function setCustomCache(fCache $cache)
{
if (static::$authorized_override) {
return false;
}
static::$enabled = true;
static::$cache = $cache;
}
示例10: request
public static function request()
{
if (empty(self::$cache)) {
static::$cache = new \Rpp\Extend\Memcached();
return static::$cache;
} else {
return static::$cache;
}
}
示例11: cache
/**
* Load annotation cache strategy
*
* @param CacheInterface $cache
* @return CacheInterface
*/
public static function cache(CacheInterface $cache = null)
{
if ($cache) {
static::$cache = $cache;
} elseif (!static::$cache) {
static::$cache = new Annotation\EphemeralCache();
}
return static::$cache;
}
示例12: setUpBeforeClass
public static function setUpBeforeClass()
{
if (!extension_loaded('xcache')) {
static::$cache = null;
return;
}
xcache_clear_cache(XC_TYPE_VAR);
static::$cache = new \Cachalot\XcacheCache('cachalot-test:');
}
示例13: setUpBeforeClass
public static function setUpBeforeClass()
{
if (!extension_loaded('apc') && !extension_loaded('apcu')) {
static::$cache = null;
return;
}
apc_clear_cache();
static::$cache = new \Cachalot\ApcCache('cachalot-test:');
}
示例14: setUpBeforeClass
public static function setUpBeforeClass()
{
if (!extension_loaded('couchbase') || !class_exists('CouchbaseCluster')) {
static::$cache = null;
return;
}
$cluster = new \CouchbaseCluster('couchbase://localhost');
$bucket = $cluster->openBucket('cachalot-test');
static::$cache = new \Cachalot\Couchbase2Cache($bucket);
}
示例15: setUpBeforeClass
public static function setUpBeforeClass()
{
if (!extension_loaded('couchbase') || !class_exists('Couchbase')) {
static::$cache = null;
return;
}
$couchbase = new \Couchbase('127.0.0.1', '', '', 'cachalot-test');
$couchbase->flush();
static::$cache = new \Cachalot\CouchbaseCache($couchbase);
}