<?xml version="1.0" encoding="UTF-8"?>
<document>
  <body>&lt;p&gt;Sets are also friendly to use - you can use set just like as it's a PHP array:&lt;/p&gt;
&lt;code&gt;
require_once 'Rediska/Key/Set.php';
$set = new Rediska_Key_Set('set');

$set[] = 'first element';
$set[] = 'second element';

echo count($set); #=&gt; 2

// check if element is in set
$isInSet = $set-&gt;exists('first element'); #=&gt; true

// Iterate set
foreach($set 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)

/**
 * Add the specified member to the Set
 * 
 * @param mixin $value Value
 * @return boolean
 */
public function add($value)

/**
 * Remove the specified member from the Set
 * 
 * @param mixin $value Value
 * @return boolean
 */
public function remove($value)

/**
 * Move the specified member from one Set to another atomically
 * 
 * @param string|Rediska_Key_Set $set   Set key name or object
 * @param mixin                  $value Value
 * @return boolean
 */
public function move($set, $value)

/**
 * Get Set length
 * 
 * @return integer
 */
public function count()

/**
 * Test if the specified value is a member of the Set
 * 
 * @prarm mixin  $value Value
 * @return boolean
 */
public function exists($value)

/**
 * Return the intersection between the Sets
 * 
 * @param string|array $setOrSets    Set key name or object, or array of its
 * @param string|null  $storeKeyName Store intersection to set with key name
 * @return array|boolean
 */
public function intersect($setOrSets, $storeKeyName = null)

/**
 * Return the union between the Sets
 * 
 * @param string|array $setOrSets    Set key name or object, or array of its
 * @param string|null  $storeKeyName Store union to set with key name
 * @return array|boolean
 */
public function union($setOrSets, $storeKeyName = null)

/**
 * Return the difference between the Sets
 * 
 * @param string|array $setOrSets    Set key name or object, or array of its
 * @param string|null  $storeKeyName Store union to set with key name
 * @return array|boolean
 */
public function diff($setOrSets, $storeKeyName = null)

/**
 * Get Set values
 * 
 * @see Rediska#getSet
 * @param string $sort Sorting query see: http://code.google.com/p/redis/wiki/SortCommand
 *                     ALPHA work incorrect becouse values in Set serailized
 * @return array
 */
public function toArray($sort = null)

/**
 * Add array to Set
 * 
 * @param array $array
 */
public function fromArray(array $array)

/**
 * 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>sets</cached-slug>
  <comments-count type="integer">0</comments-count>
  <created-at type="datetime">2010-01-21T22:07:39Z</created-at>
  <id type="integer">12</id>
  <lft type="integer">20</lft>
  <parent-id type="integer">9</parent-id>
  <rgt type="integer">21</rgt>
  <title>Sets</title>
  <updated-at type="datetime">2010-01-22T10:38:50Z</updated-at>
  <user-id type="integer">1</user-id>
</document>
