コード例 #1
0
ファイル: RedisTest.php プロジェクト: bruensicke/li3_redis
 function testIncrement()
 {
     $scope = __FUNCTION__;
     Redis::config(array('format' => $scope));
     $this->assertEqual(1, Redis::increment('foo'));
     $this->assertEqual(1, $this->redis->get("{$scope}:foo"));
     $this->assertEqual(5, Redis::increment('bar', 5));
     $this->assertEqual(5, $this->redis->get("{$scope}:bar"));
     $this->assertEqual(2, Redis::increment('foo'));
     $this->assertEqual(2, $this->redis->get("{$scope}:foo"));
     $this->assertEqual(1, Redis::increment('foo', 1, array('format' => $scope . ':test')));
     $this->assertEqual(1, $this->redis->get("{$scope}:test:foo"));
     $this->assertEqual(1, Redis::increment('foo', 1, array('namespace' => 'bar')));
     $this->assertEqual(1, $this->redis->get("{$scope}:bar:foo"));
     $this->assertEqual(1, Redis::increment('foo', 1, array('namespace' => 'bar', 'prefix' => 'baz')));
     $this->assertEqual(1, $this->redis->get("{$scope}:bar:baz:foo"));
 }