inc() public static method

自增缓存(针对数值缓存)
public static inc ( string $name, integer $step = 1 ) : false | integer
$name string 缓存变量名
$step integer 步长
return false | integer
コード例 #1
0
ファイル: cacheTestCase.php プロジェクト: top-think/framework
 public function testStaticCall()
 {
     $this->assertTrue(Cache::set('a', 1));
     $this->assertEquals(1, Cache::get('a'));
     $this->assertEquals(2, Cache::inc('a'));
     $this->assertEquals(4, Cache::inc('a', 2));
     $this->assertEquals(4, Cache::get('a'));
     $this->assertEquals(3, Cache::dec('a'));
     $this->assertEquals(1, Cache::dec('a', 2));
     $this->assertEquals(1, Cache::get('a'));
     $this->assertNotNull(Cache::rm('a'));
     $this->assertNotNull(Cache::clear());
 }