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


PHP Repository::add方法代码示例

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


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

示例1: testShouldReturnNullFlushRecord

 public function testShouldReturnNullFlushRecord()
 {
     $this->repository->add('memcached-testing', 'couchbase', 60);
     $this->repository->decrement('memcached-testing-decrement', 100);
     $this->repository->increment('memcached-testing-increment', 100);
     $this->repository->flush();
     $this->assertNull($this->repository->get('memcached-testing'));
     $this->assertNull($this->repository->get('memcached-testing-decrement'));
     $this->assertNull($this->repository->get('memcached-testing-increment'));
 }
开发者ID:ytake,项目名称:laravel-couchbase,代码行数:10,代码来源:MemcachedBucketTest.php

示例2: save

 /**
  * {@inheritdoc}
  */
 public function save($key, CacheEntry $data)
 {
     try {
         $lifeTime = $data->getTTL();
         if ($lifeTime === 0) {
             return $this->cache->forever($key, serialize($data));
         } else {
             if ($lifeTime > 0) {
                 return $this->cache->add($key, serialize($data), $lifeTime);
             }
         }
     } catch (\Exception $ignored) {
         // No fail if we can't save it the storage
     }
     return false;
 }
开发者ID:kevinrob,项目名称:guzzle-cache-middleware,代码行数:19,代码来源:LaravelCacheStorage.php

示例3: returnResults

 /**
  * Return result values
  *
  * @param array  $results
  * @param string $key
  *
  * @return string|array
  */
 protected function returnResults($results, $key)
 {
     if ($results && count($results) > 1) {
         $results = $this->arrangeResults($results, $key);
         $this->cache->add($this->attachTag($key), $results, $this->expiry);
         return $results;
     }
     if ($results) {
         $result = @json_decode($results[$key]) ?: $results[$key];
         $this->cache->add($this->attachTag($key), $result, $this->expiry);
         return $result;
     }
 }
开发者ID:illuminate3,项目名称:Setter,代码行数:21,代码来源:SettingBase.php

示例4: add

 /**
  * Store an item in the cache if the key does not exist.
  *
  * @param string $key
  * @param mixed $value
  * @param \DateTime|int $minutes
  * @return bool 
  * @static 
  */
 public static function add($key, $value, $minutes)
 {
     return \Illuminate\Cache\Repository::add($key, $value, $minutes);
 }
开发者ID:satriashp,项目名称:tour,代码行数:13,代码来源:_ide_helper.php

示例5: add

 /**
  * Store an item in the cache if the key does not exist.
  *
  * @param  mixed  $key
  * @param  mixed  $value
  * @param  \DateTime|int  $minutes
  * @return mixed
  */
 public function add($key, $value, $minutes)
 {
     if (is_array($key) && is_array($value)) {
         return $this->addMany(array_combine($key, $value), $minutes);
     }
     return parent::add($key, $value, $minutes);
 }
开发者ID:pulkitjalan,项目名称:multicache,代码行数:15,代码来源:Repository.php

示例6: add

 /**
  * Store an item in the cache if the key does not exist.
  *
  * @param  string        $key
  * @param  mixed         $value
  * @param  \DateTime|int $minutes
  * @return bool
  * @throws \Propaganistas\LaravelCacheKeywords\Exceptions\ReservedCacheKeyPatternException
  */
 public function add($key, $value, $minutes)
 {
     $this->checkReservedKeyPattern($key);
     $this->setKeywordsOperation(true);
     if ($result = parent::add($key, $value, $minutes)) {
         $this->storeKeywords($key, $minutes, $this->keywords);
     }
     $this->setKeywordsOperation(false);
     $this->resetCurrentKeywords();
     return $result;
 }
开发者ID:propaganistas,项目名称:laravel-cache-keywords,代码行数:20,代码来源:KeywordsRepository.php

示例7: add

 /**
  * Store an item in the cache if the key does not exist.
  *
  * @param  string        $key
  * @param  mixed         $value
  * @param  \DateTime|int $minutes
  *
  * @return bool
  */
 public function add($key, $value, $minutes)
 {
     return $this->enabled ? $this->cache->add($key, $value, $minutes) : false;
 }
开发者ID:wegnermedia,项目名称:melon,代码行数:13,代码来源:Cacher.php

示例8: setItem

 /**
  * Set cache entry
  *
  * @param string $key
  * @param string $content
  *
  * @return void
  */
 public function setItem($key, $content)
 {
     $key = $this->getKey($key);
     $ttl = $this->configurationRepository->get('shariff.cache.ttl');
     $this->cacheRepository->add($key, $content, $ttl);
 }
开发者ID:cedricziel,项目名称:l5-shariff,代码行数:14,代码来源:Cache.php


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