當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。