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


PHP Cache::setNamespace方法代码示例

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


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

示例1: init

 /**
  * Initialization that sets a base key and the driver based on configuration settings
  *
  * @param  Grav $grav
  * @return void
  */
 public function init(Grav $grav)
 {
     /** @var Config $config */
     $this->config = $grav['config'];
     /** @var Uri $uri */
     $uri = $grav['uri'];
     $prefix = $this->config->get('system.cache.prefix');
     $this->enabled = (bool) $this->config->get('system.cache.enabled');
     // Cache key allows us to invalidate all cache on configuration changes.
     $this->key = substr(md5(($prefix ? $prefix : 'g') . $uri->rootUrl(true) . $this->config->key . GRAV_VERSION), 2, 8);
     $this->driver = $this->getCacheDriver();
     // Set the cache namespace to our unique key
     $this->driver->setNamespace($this->key);
 }
开发者ID:miguelramos,项目名称:grav,代码行数:20,代码来源:Cache.php

示例2: flush

 public function flush()
 {
     foreach ($this->objects as $className => $objects) {
         $this->cache->setNamespace($className);
         $this->cache->saveMultiple($objects);
     }
 }
开发者ID:mihai-stancu,项目名称:cache-bundle,代码行数:7,代码来源:Manager.php

示例3: init

 /**
  * Initialization that sets a base key and the driver based on configuration settings
  *
  * @param  Grav $grav
  * @return void
  */
 public function init(Grav $grav)
 {
     /** @var Config $config */
     $this->config = $grav['config'];
     $this->now = time();
     $this->cache_dir = $grav['locator']->findResource('cache://doctrine', true, true);
     /** @var Uri $uri */
     $uri = $grav['uri'];
     $prefix = $this->config->get('system.cache.prefix');
     $this->enabled = (bool) $this->config->get('system.cache.enabled');
     // Cache key allows us to invalidate all cache on configuration changes.
     $this->key = ($prefix ? $prefix : 'g') . '-' . substr(md5($uri->rootUrl(true) . $this->config->key() . GRAV_VERSION), 2, 8);
     $this->driver = $this->getCacheDriver();
     // Set the cache namespace to our unique key
     $this->driver->setNamespace($this->key);
 }
开发者ID:clee03,项目名称:metal,代码行数:22,代码来源:Cache.php

示例4: updateCredentials

 /**
  * Changes the credentials used to authenticate with QBank.
  *
  * Changing the credentials will effectively switch the user using QBank and is useful when implementing some tiered
  * service.
  *
  * @param string $user Username of the new user.
  * @param string $password Password of the new user.
  *
  * @return void
  */
 public function updateCredentials($user, $password)
 {
     $oldUser = $this->credentials->getUsername();
     $this->credentials = new Credentials($this->credentials->getClientId(), $user, $password);
     unset($password);
     if ($this->client instanceof Client) {
         $this->client->getEmitter()->detach($this->oauth2Subscriber);
         $this->oauth2Subscriber = null;
         $this->client->getEmitter()->attach($this->getOAuth2Subscriber());
     }
     if ($this->cache instanceof CacheProvider) {
         $this->cache->setNamespace(md5($this->basepath . $this->credentials->getUsername() . $this->credentials->getPassword()));
     }
     $this->logger->notice('Updated user!', ['old' => $oldUser, 'new' => $user]);
 }
开发者ID:QBNK,项目名称:qbank3api-phpwrapper,代码行数:26,代码来源:QBankApi.php

示例5: setNamespace

 /**
  * set namespace to prevent cache naming collision.
  * 
  * @param string $cache_namespace
  * @return type
  */
 public function setNamespace($cache_namespace)
 {
     return $this->CacheDriver->setNamespace($cache_namespace);
 }
开发者ID:AgniCMS,项目名称:agni-framework,代码行数:10,代码来源:Cache.php

示例6: findOneBy

 /**
  * @param array $criteria
  *
  * @return object[]
  */
 public function findOneBy(array $criteria)
 {
     $this->cache->setNamespace($this->className);
     $id = $this->getId($criteria);
     return $this->cache->fetch($id);
 }
开发者ID:mihai-stancu,项目名称:cache-bundle,代码行数:11,代码来源:Repository.php


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