예제 #1
0
파일: List.php 프로젝트: cargomedia/cm
 public function getItems($offset = null, $count = null)
 {
     $cacheKey = array('items', $offset, $count);
     if (($items = $this->_cacheGet($cacheKey)) === false) {
         $stop = null;
         if ($count !== null) {
             $stop = $offset + $count - 1;
         }
         $items = $this->_client->lRange($this->_key, $offset, $stop);
         $this->_cacheSet($cacheKey, $items);
     }
     return $items;
 }
예제 #2
0
 public function testLRange()
 {
     $this->_client->rPush('foo', 'bar1');
     $this->_client->rPush('foo', 'bar2');
     $this->_client->rPush('foo', 'bar3');
     $this->assertSame(array('bar1', 'bar2', 'bar3'), $this->_client->lRange('foo'));
     $this->assertSame(array('bar2', 'bar3'), $this->_client->lRange('foo', 1));
     $this->assertSame(array('bar2'), $this->_client->lRange('foo', 1, 1));
 }