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


PHP Cache::decrement方法代码示例

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


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

示例1: bootstrap

 public static function bootstrap()
 {
     // Configure Pheal
     PhealConfig::getInstance()->cache = new \Pheal\Cache\FileStorage(storage_path() . '/cache/phealcache/');
     PhealConfig::getInstance()->access = new \Pheal\Access\StaticCheck();
     PhealConfig::getInstance()->log = new \Pheal\Log\FileStorage(storage_path() . '/logs/');
     PhealConfig::getInstance()->api_customkeys = true;
     PhealConfig::getInstance()->http_method = 'curl';
     // Build a meaningful User-Agent for CCP should they need to contact someone
     $user_agent = 'SeAT ' . \Config::get('seat.version') . ' API Fetcher at ' . \Config::get('app.url');
     // Add the Url
     // If the administrative_contact is set, add this to the User-Agent, else use the
     // default mail_from in the settings
     if (Settings::getSetting('administrative_contact') == null) {
         $user_agent .= ' Install mail_from: ' . \Config::get('mail.from.name') . ' <' . \Config::get('mail.from.address') . '>';
     } else {
         $user_agent .= ' Administrative Contact: ' . Settings::getSetting('administrative_contact');
     }
     // Set the newly compiled User-Agent
     PhealConfig::getInstance()->http_user_agent = $user_agent;
     // Should the EVE api be determined as 'down', set the cache value for 'eve_api_down'
     // with a expiration of 30 minutes. We will also decrement the current error count
     // by 10 to allow for some calls to happen after the value has expired out of
     // cache
     if (\Cache::get('eve_api_error_count') >= \Config::get('seat.error_limit')) {
         \Cache::put('eve_api_down', true, 30);
         \Cache::decrement('eve_api_error_count', 10);
     }
     // Check if the EVE Api has been detected as 'down'.
     if (\Cache::has('eve_api_down')) {
         throw new Exception\APIServerDown();
     }
     // Disable the Laravel query log. Some of the API calls do.. a lot of queries :P
     \DB::connection()->disableQueryLog();
 }
开发者ID:boweiliu,项目名称:seat,代码行数:35,代码来源:BaseAPI.php

示例2: Cache

 function test_incr_decr()
 {
     $c = new Cache();
     $this->assertTrue($c->set('foo', 0));
     $this->assertEquals($c->increment('foo'), 1);
     $this->assertEquals($c->increment('foo'), 2);
     $this->assertEquals($c->increment('foo', 2), 4);
     $this->assertEquals($c->decrement('foo'), 3);
     $this->assertEquals($c->get('foo'), 3);
 }
开发者ID:Selwyn-b,项目名称:elefant,代码行数:10,代码来源:CacheTest.php

示例3: testDecrement

 /**
  * testDecrement method
  *
  * @return void
  */
 public function testDecrement()
 {
     Cache::delete('test_decrement', 'redis');
     $result = Cache::write('test_decrement', 5, 'redis');
     $this->assertTrue($result);
     $result = Cache::decrement('test_decrement', 1, 'redis');
     $this->assertEquals(4, $result);
     $result = Cache::read('test_decrement', 'redis');
     $this->assertEquals(4, $result);
     $result = Cache::decrement('test_decrement', 2, 'redis');
     $this->assertEquals(2, $result);
     $result = Cache::read('test_decrement', 'redis');
     $this->assertEquals(2, $result);
 }
开发者ID:pushpendraraj,项目名称:tigzie,代码行数:19,代码来源:RedisEngineTest.php

示例4: testDecrement

 /**
  * testDecrement method
  *
  * @return void
  */
 public function testDecrement()
 {
     $this->skipIf(!function_exists('wincache_ucache_dec'), 'No wincache_ucache_dec() function, cannot test decrement().');
     $result = Cache::write('test_decrement', 5, 'wincache');
     $this->assertTrue($result);
     $result = Cache::decrement('test_decrement', 1, 'wincache');
     $this->assertEquals(4, $result);
     $result = Cache::read('test_decrement', 'wincache');
     $this->assertEquals(4, $result);
     $result = Cache::decrement('test_decrement', 2, 'wincache');
     $this->assertEquals(2, $result);
     $result = Cache::read('test_decrement', 'wincache');
     $this->assertEquals(2, $result);
 }
开发者ID:jgera,项目名称:orangescrum,代码行数:19,代码来源:WincacheEngineTest.php

示例5: testReadNonExistingConfig

 /**
  * Test reading from a config that is undefined.
  *
  * @return void
  */
 public function testReadNonExistingConfig()
 {
     $this->assertFalse(Cache::read('key', 'totally fake'));
     $this->assertFalse(Cache::write('key', 'value', 'totally fake'));
     $this->assertFalse(Cache::increment('key', 1, 'totally fake'));
     $this->assertFalse(Cache::decrement('key', 1, 'totally fake'));
 }
开发者ID:ronaldsalazar23,项目名称:ComercialChiriguano,代码行数:12,代码来源:CacheTest.php

示例6: testDecrement

 /**
  * testDecrement method
  *
  * @return void
  */
 public function testDecrement()
 {
     $result = Cache::write('test_decrement', 5);
     $this->assertTrue($result);
     $result = Cache::decrement('test_decrement');
     $this->assertEquals(4, $result);
     $result = Cache::read('test_decrement');
     $this->assertEquals(4, $result);
     $result = Cache::decrement('test_decrement', 2);
     $this->assertEquals(2, $result);
     $result = Cache::read('test_decrement');
     $this->assertEquals(2, $result);
 }
开发者ID:Marcin11,项目名称:_mojePanstwo-Portal,代码行数:18,代码来源:XcacheEngineTest.php

示例7: testDecrement

 /**
  * testDecrement method
  *
  * @return void
  */
 public function testDecrement()
 {
     $result = Cache::write('test_decrement', 5, 'memcache');
     $this->assertTrue($result);
     $result = Cache::decrement('test_decrement', 1, 'memcache');
     $this->assertEqual(4, $result);
     $result = Cache::read('test_decrement', 'memcache');
     $this->assertEqual(4, $result);
     $result = Cache::decrement('test_decrement', 2, 'memcache');
     $this->assertEqual(2, $result);
     $result = Cache::read('test_decrement', 'memcache');
     $this->assertEqual(2, $result);
 }
开发者ID:nabeelio,项目名称:CakePHP-Base,代码行数:18,代码来源:MemcacheTest.php

示例8: testDecrement

 /**
  * testDecrement method
  *
  * @access public
  * @return void
  */
 function testDecrement()
 {
     if ($this->skipIf(!function_exists('apc_dec'), 'No apc_dec() function, cannot test decrement() %s')) {
         return;
     }
     $result = Cache::write('test_decrement', 5);
     $this->assertTrue($result);
     $result = Cache::decrement('test_decrement');
     $this->assertEqual(4, $result);
     $result = Cache::read('test_decrement');
     $this->assertEqual(4, $result);
     $result = Cache::decrement('test_decrement', 2);
     $this->assertEqual(2, $result);
     $result = Cache::read('test_decrement');
     $this->assertEqual(2, $result);
 }
开发者ID:arendasistemasintegrados,项目名称:mateusleme,代码行数:22,代码来源:apc.test.php

示例9: testDecrementCompressedKeys

 /**
  * test decrementing compressed keys
  *
  * @return void
  */
 public function testDecrementCompressedKeys()
 {
     Cache::config('compressed_memcached', array('engine' => 'Memcached', 'duration' => '+2 seconds', 'servers' => array('127.0.0.1:11211'), 'compress' => true));
     $result = Cache::write('test_decrement', 5, 'compressed_memcached');
     $this->assertTrue($result);
     $result = Cache::decrement('test_decrement', 1, 'compressed_memcached');
     $this->assertEquals(4, $result);
     $result = Cache::read('test_decrement', 'compressed_memcached');
     $this->assertEquals(4, $result);
     $result = Cache::decrement('test_decrement', 2, 'compressed_memcached');
     $this->assertEquals(2, $result);
     $result = Cache::read('test_decrement', 'compressed_memcached');
     $this->assertEquals(2, $result);
     Cache::delete('test_decrement', 'compressed_memcached');
 }
开发者ID:hodrigohamalho,项目名称:cakephp-ex,代码行数:20,代码来源:MemcachedEngineTest.php

示例10: decreateCount

 public function decreateCount($key, $inc = 1)
 {
     return $this->cache->decrement($key, $inc);
 }
开发者ID:GameCrusherTechnology,项目名称:HeroTowerServer,代码行数:4,代码来源:MemCounter.class.php

示例11: end

 public static function end()
 {
     Cache::decrement(static::getKey());
 }
开发者ID:mehulsbhatt,项目名称:MindaPHP,代码行数:4,代码来源:Firewall.php

示例12: testDecrement

 /**
  * testDecrement method
  *
  * @return void
  */
 public function testDecrement()
 {
     $hasSupport = function_exists('apc_dec') || function_exists('apcu_dec');
     $this->skipIf(!$hasSupport, 'No apc_dec()/apcu_dec() function, cannot test decrement().');
     $result = Cache::write('test_decrement', 5, 'apc');
     $this->assertTrue($result);
     $result = Cache::decrement('test_decrement', 1, 'apc');
     $this->assertEquals(4, $result);
     $result = Cache::read('test_decrement', 'apc');
     $this->assertEquals(4, $result);
     $result = Cache::decrement('test_decrement', 2, 'apc');
     $this->assertEquals(2, $result);
     $result = Cache::read('test_decrement', 'apc');
     $this->assertEquals(2, $result);
 }
开发者ID:mgoo,项目名称:MovieServer,代码行数:20,代码来源:ApcEngineTest.php


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