当前位置: 首页>>代码示例>>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;未经允许,请勿转载。