當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。