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; }
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)); }