示例#1
0
 public function testCounter()
 {
     $cacheKey = 'test.counter';
     Cache::set($cacheKey, 0);
     $count = Cache::increment($cacheKey);
     $this->assertEquals(1, $count);
     $count = Cache::increment($cacheKey, 2);
     $this->assertEquals(3, $count);
     $count = Cache::decrement($cacheKey);
     $this->assertEquals(2, $count);
     $count = Cache::decrement($cacheKey, 2);
     $this->assertEquals(0, $count);
 }