當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Cache::decrement方法代碼示例

本文整理匯總了PHP中Cake\Cache\Cache::decrement方法的典型用法代碼示例。如果您正苦於以下問題:PHP Cache::decrement方法的具體用法?PHP Cache::decrement怎麽用?PHP Cache::decrement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Cake\Cache\Cache的用法示例。


在下文中一共展示了Cache::decrement方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testDecrementCompressedKeys

 /**
  * test decrementing compressed keys
  *
  * @return void
  */
 public function testDecrementCompressedKeys()
 {
     Cache::config('compressed_memcached', ['engine' => 'Memcached', 'duration' => '+2 seconds', 'servers' => ['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:KarimaLadhani,項目名稱:cakephp,代碼行數:20,代碼來源:MemcachedEngineTest.php

示例2: 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:ripzappa0924,項目名稱:carte0.0.1,代碼行數:19,代碼來源:RedisEngineTest.php

示例3: testDecrement

 /**
  * testDecrement method
  *
  * @return void
  */
 public function testDecrement()
 {
     $this->skipIf(!function_exists('apc_dec'), 'No apc_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:maitrepylos,項目名稱:nazeweb,代碼行數:19,代碼來源:ApcEngineTest.php

示例4: testDecrementNonExistingConfig

 /**
  * Test write from a config that is undefined.
  *
  * @expectedException InvalidArgumentException
  * @return void
  */
 public function testDecrementNonExistingConfig()
 {
     $this->assertFalse(Cache::decrement('key', 1, 'totally fake'));
 }
開發者ID:maitrepylos,項目名稱:nazeweb,代碼行數:10,代碼來源:CacheTest.php


注:本文中的Cake\Cache\Cache::decrement方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。