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


PHP Service::getModelCache方法代碼示例

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


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

示例1: storeInCache

 /**
  * Store the model in the cache
  *
  * @return self
  */
 protected function storeInCache()
 {
     if (!Service::getModelCache()) {
         return $this;
     }
     Service::getModelCache()->save($this);
     return $this;
 }
開發者ID:allejo,項目名稱:bzion,代碼行數:13,代碼來源:CachedModel.php

示例2: retrieveFromCache

 /**
  * Load the current object's properties from the cache
  * @return bool True if the assignement was successful, false if the model
  *              doesn't exist in the cache
  */
 protected function retrieveFromCache()
 {
     if (!$this->existsInCache()) {
         return false;
     }
     $cachedModel = Service::getModelCache()->get(get_class($this), $this->id);
     $this->copy($cachedModel);
     return true;
 }
開發者ID:kleitz,項目名稱:bzion,代碼行數:14,代碼來源:CachedModel.php

示例3: collect

 /**
  * Collects data for the given Request and Response, so that it can be
  * serialized and stored for later retrieval
  *
  * @param Request    $request   A Request instance
  * @param Response   $response  A Response instance
  * @param \Exception $exception An Exception instance
  */
 public function collect(Request $request, Response $response, \Exception $exception = null)
 {
     $this->data = array('queries' => $this->queries, 'cachedModels' => \Service::getModelCache()->all(), 'cacheFetches' => $this->cacheFetches);
 }
開發者ID:blast007,項目名稱:bzion,代碼行數:12,代碼來源:DatabaseDataCollector.php

示例4: clearDatabase

 /**
  * @Given that the database is empty
  */
 public static function clearDatabase()
 {
     $db = Database::getInstance();
     // Get an array of the tables in the database, so that we can remove them
     $tables = array_map(function ($val) {
         return current($val);
     }, $db->query('SHOW TABLES'));
     if (count($tables) > 0) {
         $db->execute('SET foreign_key_checks = 0');
         $db->execute('DROP TABLES ' . implode($tables, ','));
         $db->execute('SET foreign_key_checks = 1');
     }
     ScriptHandler::migrateDatabase(null, true);
     if ($modelCache = Service::getModelCache()) {
         $modelCache->clear();
     }
 }
開發者ID:allejo,項目名稱:bzion,代碼行數:20,代碼來源:FeatureContext.php


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