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


PHP Repository::forget方法代码示例

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


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

示例1: save

 public function save()
 {
     // New and changed keys
     $changed = array_diff_assoc($this->data, $this->original);
     $insertValues = array();
     foreach ($changed as $name => $value) {
         if (!array_key_exists($name, $this->original)) {
             $insertValues[] = array('conf_name' => $name, 'conf_value' => $value);
             unset($changed[$name]);
         }
     }
     if (!empty($insertValues)) {
         $this->database->table('config')->insert($insertValues);
     }
     foreach ($changed as $name => $value) {
         $this->database->table('config')->where('conf_name', '=', $name)->update(array('conf_value' => $value));
     }
     // Deleted keys
     $deletedKeys = array_keys(array_diff_key($this->original, $this->data));
     if (!empty($deletedKeys)) {
         $this->database->table('config')->whereIn('conf_name', $deletedKeys)->delete();
     }
     // No need to cache old values anymore
     $this->original = $this->data;
     // Delete the cache so that it will be regenerated on the next request
     $this->cache->forget('fluxbb.config');
 }
开发者ID:fluxbb,项目名称:core,代码行数:27,代码来源:ConfigRepository.php

示例2: testShouldReturnIncrementalValues

 public function testShouldReturnIncrementalValues()
 {
     $this->repository->increment('memcached-testing');
     $this->assertSame(1, $this->repository->get('memcached-testing'));
     $this->repository->increment('memcached-testing', 100);
     $this->assertSame(101, $this->repository->get('memcached-testing'));
     $this->repository->decrement('memcached-testing', 100);
     $this->assertSame(1, $this->repository->get('memcached-testing'));
     $this->repository->decrement('memcached-testing', 100);
     $this->assertSame(0, $this->repository->get('memcached-testing'));
     $this->repository->forget('memcached-testing');
     $this->repository->decrement('memcached-testing', 100);
     $this->assertSame(0, $this->repository->get('memcached-testing'));
     $this->repository->forget('memcached-testing');
 }
开发者ID:ytake,项目名称:laravel-couchbase,代码行数:15,代码来源:MemcachedBucketTest.php

示例3: clear

 /**
  * clear all caches
  */
 public function clear()
 {
     $this->cache->forget(self::INDEX_KEY);
     foreach ($this->cache->get(self::CACHE_KEYS_KEY) as $key) {
         $this->cache->forget($key);
     }
     $this->cache->forget(self::CACHE_KEYS_KEY);
 }
开发者ID:rokde,项目名称:laravel-query-analyzer,代码行数:11,代码来源:QueryRepository.php

示例4: flush

 /**
  * Flush the cache for this Model Object instance
  *
  * @param Model $model
  * @return void
  */
 public function flush(Model $model)
 {
     // Assemble Cache Keys
     $keys[] = $this->resourceName . '.hash.' . $model->hash;
     $keys[] = $this->resourceName . '.id.' . $model->id;
     // Some keys will not be available on all models
     $referenceColumn = $this->referenceIdColumnName();
     if ($this->model->isFillable($referenceColumn)) {
         $keys[] = $this->resourceName . '.' . $referenceColumn . '.' . $model->{$referenceColumn};
     }
     // Clear the cache for the given keys
     foreach ($keys as $key) {
         $this->cache->forget($key);
     }
 }
开发者ID:srlabs,项目名称:groundwork,代码行数:21,代码来源:BaseRepository.php

示例5: handle

 /**
  * Handle the form.
  *
  * @param  Repository                                 $cache
  * @param  Redirector                                 $redirect
  * @param                                             $key
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function handle(Repository $cache, Redirector $redirect, $key)
 {
     $parameters = $cache->get('form::' . $key);
     /* @var FormCriteria $criteria */
     $criteria = $this->dispatch(new GetFormCriteria($parameters));
     /* @var FormBuilder $builder */
     $builder = $criteria->build();
     $response = $builder->build()->post()->getFormResponse();
     $builder->flash();
     $cache->forget('form::' . $key);
     if ($response && $response->getStatusCode() !== 200) {
         return $response;
     }
     if ($builder->isAjax()) {
         return $builder->getFormResponse();
     }
     if ($builder->hasFormErrors()) {
         return $redirect->back();
     }
     return $response ?: $redirect->back();
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:29,代码来源:FormController.php

示例6: forget

 /**
  * Remove an item from the cache.
  *
  * @param string $key
  * @return bool 
  * @static 
  */
 public static function forget($key)
 {
     return \Illuminate\Cache\Repository::forget($key);
 }
开发者ID:satriashp,项目名称:tour,代码行数:11,代码来源:_ide_helper.php

示例7: forget

 /**
  * Remove an item from the cache.
  *
  * @param  mixed $key
  * @return bool
  */
 public function forget($key)
 {
     if (is_array($key)) {
         return $this->forgetMany($key);
     }
     return parent::forget($key);
 }
开发者ID:pulkitjalan,项目名称:multicache,代码行数:13,代码来源:Repository.php

示例8: forget

 /**
  * Forget settings cache.
  *
  * @return bool
  */
 public function forget()
 {
     return $this->cache->forget(self::CACHE_KEY);
 }
开发者ID:rabbitcms,项目名称:settings,代码行数:9,代码来源:Repository.php

示例9: destroy

 /**
  * {@inheritDoc}
  */
 public function destroy($sessionId)
 {
     return $this->cache->forget($sessionId);
 }
开发者ID:rodrigopbel,项目名称:ong,代码行数:7,代码来源:CacheBasedSessionHandler.php

示例10: forgetCodeFromCache

 /**
  * 删除验证码
  * @param string $mobile
  * @param string $bag
  */
 public function forgetCodeFromCache($mobile, $bag)
 {
     $key = $this->getCacheKey($mobile, $bag);
     return $this->store->forget($key);
 }
开发者ID:windqyoung,项目名称:utils,代码行数:10,代码来源:VCode.php

示例11: flush

 /**
  * Flushes traces of records related to the provided keywords, otherwise proceeds to regular flush() method.
  */
 public function flush()
 {
     if (!empty($this->keywords)) {
         $flushedKeys = $this->forgetKeywordIndex($this->keywords);
         $affectedKeywords = $this->forgetInverseIndex($flushedKeys);
         foreach ($flushedKeys as $flushedKey) {
             // Set all affected keywords as old keywords and request
             // empty new keywords to remove the flushed key from other indices as well.
             $this->determineKeywordsState($flushedKey, [], $affectedKeywords);
             $this->updateKeywordIndex($flushedKey);
             parent::forget($flushedKey);
         }
     } else {
         parent::flush();
     }
     if (!$this->operatingOnKeywords()) {
         $this->resetCurrentKeywords();
     }
 }
开发者ID:propaganistas,项目名称:laravel-cache-keywords,代码行数:22,代码来源:KeywordsRepository.php

示例12: forget

 /**
  * Remove an item from the cache.
  *
  * @param  string $key
  *
  * @return bool
  */
 public function forget($key)
 {
     return $this->enabled ? $this->cache->forget($key) : false;
 }
开发者ID:wegnermedia,项目名称:melon,代码行数:11,代码来源:Cacher.php

示例13: deleteCachedSiteInstanceRoutes

 /**
  * deleteCachedSiteInstanceRoutes
  *
  * @param string $siteKey key of site
  *
  * @return void
  */
 public function deleteCachedSiteInstanceRoutes($siteKey)
 {
     $keyString = $this->getSiteCacheKeyString($siteKey);
     $this->cache->forget($keyString);
 }
开发者ID:mint-soft-com,项目名称:xpressengine,代码行数:12,代码来源:InstanceRouteCacheHandler.php


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