public function length($key, $type = null)
	{
		if (is_null($type)) $type = $this->type($key);

		switch ($type)
		{
			case 'list':
				return $this->database->llen($key);

			case 'zset':
				return $this->database->zcard($key);

			default:
				throw new UnexpectedValueException("List type '{$type}' not supported.");
		}
	}
public function length($key, $type = null)
	{
		if (is_null($type)) $type = $this->type($key);

		switch ($type)
		{
			case 'list':
				return $this->database->llen($key);

			case 'zset':
				return $this->database->zcard($key);

			default:
				throw new UnexpectedValueException("List type '{$type}' not supported.");
		}
	}
public function length ( $ key , $ type = null ) { if ( is_null ( $ type ) ) $ type = $ this -> type ( $ key ) ; switch ( $ type ) { case 'list' : return $ this -> database -> llen ( $ key ) ; case 'zset' : return $ this -> database -> zcard ( $ key ) ; default : throw new UnexpectedValueException ( "List type '{$type}' not supported." ) ; } }
Return the length of a given list or set.

@param  string  $key
@param  string  $type
@return integer|\UnexpectedValueException
Return the length of a given list or set .