<?xml version="1.0" encoding="UTF-8"?>
<document>
  <body>&lt;p&gt;Good news, you can work with Redis lists as with native PHP arrays:&lt;/p&gt;
&lt;code&gt;
require_once 'Rediska/Key/List.php';
$list = new Rediska_Key_List('list');

$list[] = 'first element';
$list[] = 'second element';

echo $list[1]; #=&gt; 'second element';

$list[0] = 'new first element';

echo count($list); #=&gt; 2

echo isset($list[0]); #=&gt; true

// Iterate list
foreach($list as $element) {
    echo $element;
}
&lt;/code&gt;
&lt;h3&gt;All methods&lt;/h3&gt;
&lt;code&gt;
/**
 * Construct key
 * 
 * @param string  $name   Key name
 * @param integer $expire Expire time in seconds
 */
public function __construct($name, $expire = null)

/**
 * Append value to the end of List
 * 
 * @param mixin $value Value
 * @return boolean
 */
public function append($value)

/**
 * Append value to the head of List
 * 
 * @param mixin $value Value
 * @return boolean
 */
public function prepend($value)
/**
 * Get List length
 * 
 * @return integer
 */
public function count()

/**
 * Get List values
 * 
 * @see Rediska#getList
 * @param integer|string $limitOrSort Limit of elements or sorting query
 *                                    ALPHA work incorrect becouse values in List serailized
 *                                    Read more: http://code.google.com/p/redis/wiki/SortCommand
 * @param integer        $offset      Offset
 * @return array
 */
public function toArray($limitOrSort = null, $offset = null)
/**
 * Add array to List
 * 
 * @param array $array
 */
public function fromArray(array $array)

/**
 * Trim the list at key to the specified range of elements
 * 
 * @param integer $start Start index
 * @param integer $end End index
 * @return boolean
 */
public function truncate($limit, $offset = 0)

/**
 * Return element of List by index
 * 
 * @param integer $index Index
 * @return mixin
 */
public function get($index)

/**
 * Set a new value as the element at index position of the List
 * 
 * @param mixin $value Value
 * @param integer $index Index
 * @return boolean
 */
public function set($index, $value)

/**
 * Delete element from list by value
 * 
 * @throws Rediska_Exception
 * @param $value Element value
 * @param $count Limit of deleted items
 * @return integer
 */
public function remove($value, $count = 0)

/**
 * Return and remove the first element of the List
 * 
 * @return mixin
 */
public function shift()

/**
 * Return and remove the last element of the List
 * 
 * @return mixin
 */
public function pop()

/**
 * Delete key
 * 
 * @return boolean
 */
public function delete()

/**
 * Exists in db
 * 
 * @return boolean
 */
public function isExists()

/**
 * Get key type
 * 
 * @see Rediska#getType
 * @return string
 */
public function getType()

/**
 * Rename key
 * 
 * @param string  $newName
 * @param boolean $overwrite
 * @return boolean
 */
public function rename($newName, $overwrite = true)

/**
 * Expire key
 * 
 * @param integer $seconds
 * @return boolean
 */
public function expire($seconds)

/**
 * Get key lifetime
 * 
 * @return integer
 */
public function getLifetime()

/**
 * Move key to other Db
 * 
 * @see Rediska#moveToDb
 * @param integer $dbIndex
 * @return boolean
 */
public function moveToDb($dbIndex)

/**
 * Get key name
 * 
 * @return string
 */
public function getName()

/**
 * Set key name
 * 
 * @param string $name
 * @return Rediska_Key_Abstract
 */
public function setName($name)

/**
 * Set Rediska instance
 * 
 * @param Rediska $rediska
 * @return Rediska_Key_Abstract
 */
public function setRediska(Rediska $rediska)

/**
 * Get Rediska instance
 * 
 * @return Rediska
 */
public function getRediska()
&lt;/code&gt;</body>
  <cached-slug>lists</cached-slug>
  <comments-count type="integer">0</comments-count>
  <created-at type="datetime">2010-01-21T22:01:03Z</created-at>
  <id type="integer">11</id>
  <lft type="integer">18</lft>
  <parent-id type="integer">9</parent-id>
  <rgt type="integer">19</rgt>
  <title>Lists</title>
  <updated-at type="datetime">2010-01-22T10:34:02Z</updated-at>
  <user-id type="integer">1</user-id>
</document>
