當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DboSource::methodCache方法代碼示例

本文整理匯總了PHP中DboSource::methodCache方法的典型用法代碼示例。如果您正苦於以下問題:PHP DboSource::methodCache方法的具體用法?PHP DboSource::methodCache怎麽用?PHP DboSource::methodCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DboSource的用法示例。


在下文中一共展示了DboSource::methodCache方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testFieldsCacheKeyWithSchemanameChange

 /**
  * test that fields() method cache detects schema name changes
  *
  * @return void
  */
 public function testFieldsCacheKeyWithSchemanameChange()
 {
     if ($this->db instanceof Postgres || $this->db instanceof Sqlserver) {
         $this->markTestSkipped('Cannot run this test with SqlServer or Postgres');
     }
     Cache::delete('method_cache', '_cake_core_');
     DboSource::$methodCache = array();
     $Article = ClassRegistry::init('Article');
     $ds = $Article->getDataSource();
     $ds->cacheMethods = true;
     $first = $ds->fields($Article);
     $Article->schemaName = 'secondSchema';
     $ds = $Article->getDataSource();
     $ds->cacheMethods = true;
     $second = $ds->fields($Article);
     $this->assertEquals(2, count(DboSource::$methodCache['fields']));
 }
開發者ID:thanphong,項目名稱:do-an-tot-nghiep-project,代碼行數:22,代碼來源:DboSourceTest.php

示例2: cacheMethod

/**
 * Cache a value into the methodCaches.  Will respect the value of DboSource::$cacheMethods.
 * Will retrieve a value from the cache if $value is null.
 *
 * If caching is disabled and a write is attempted, the $value will be returned.
 * A read will either return the value or null.
 *
 * @param string $method Name of the method being cached.
 * @param string $key The keyname for the cache operation.
 * @param mixed $value The value to cache into memory.
 * @return mixed Either null on failure, or the value if its set.
 */
	public function cacheMethod($method, $key, $value = null) {
		if ($this->cacheMethods === false) {
			return $value;
		}
		if (empty(self::$methodCache)) {
			self::$methodCache = Cache::read('method_cache', '_cake_core_');
		}
		if ($value === null) {
			return (isset(self::$methodCache[$method][$key])) ? self::$methodCache[$method][$key] : null;
		}
		$this->_methodCacheChange = true;
		return self::$methodCache[$method][$key] = $value;
	}
開發者ID:sherix88,項目名稱:sigedu,代碼行數:25,代碼來源:DboSource.php

示例3: _clearCache

 protected function _clearCache()
 {
     DboSource::$methodCache = array();
     $keys = Cache::configured();
     foreach ($keys as $key) {
         Cache::clear(false, $key);
     }
     ClassRegistry::flush();
 }
開發者ID:radig,項目名稱:auditable,代碼行數:9,代碼來源:AuditableShell.php

示例4: _clearCache

 /**
  * Clear all caches present related to models
  *
  * Before the 'after' callback method be called is needed to clear all caches.
  * Without it any model operations will use cached data instead of real/modified
  * data.
  *
  * @return void
  */
 protected function _clearCache()
 {
     // Clear the cache
     DboSource::$methodCache = array();
     $keys = Cache::configured();
     foreach ($keys as $key) {
         Cache::clear(false, $key);
     }
     ClassRegistry::flush();
     // Refresh the model, in case something changed
     if ($this->Version instanceof MigrationVersion) {
         $this->Version->initVersion();
     }
 }
開發者ID:asadaqain,項目名稱:Guide-on-the-Side,代碼行數:23,代碼來源:CakeMigration.php

示例5: _clearCache

 /**
  * Clear all caches present related to models
  *
  * Before the 'after' callback method be called is needed to clear all caches.
  * Without it any model operations will use cached data instead of real/modified
  * data.
  *
  * @return void
  */
 protected function _clearCache()
 {
     // Clear the cache
     DboSource::$methodCache = array();
     $keys = Cache::configured();
     foreach ($keys as $key) {
         Cache::clear(false, $key);
     }
     ClassRegistry::flush();
     // Refresh the model, in case something changed
     $options = array('class' => 'Migrations.SchemaMigration', 'ds' => $this->connection);
     $this->Version->Version =& ClassRegistry::init($options);
     $this->Version->Version->setDataSource($this->connection);
 }
開發者ID:Demired,項目名稱:CakeWX,代碼行數:23,代碼來源:CakeMigration.php


注:本文中的DboSource::methodCache方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。