RedisSet

play.api.cache.redis.RedisSet
trait RedisSet[Elem, Result[_]]

Redis Sets are simply unsorted sets of objects. It is possible to add elements to a Redis Set by adding new elements into the collection.

This simplified wrapper implements only unordered Sets.

Type parameters

Elem

Data type of the inserted element

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Type members

Types

override type This = RedisSet[Elem, Result]

Value members

Abstract methods

def add(element: Elem*): Result[This]

Add the specified members to the set stored at key. Specified members that are already a member of this set are ignored. If key does not exist, a new set is created before adding the specified members.

Add the specified members to the set stored at key. Specified members that are already a member of this set are ignored. If key does not exist, a new set is created before adding the specified members.

Value parameters

element

elements to be added

Attributes

Returns

the set for chaining calls

Note

An error is returned when the value stored at key is not a set.

Time complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments.

def contains(element: Elem): Result[Boolean]

Tests if the element is contained in the set. Returns true if exists, otherwise returns false

Tests if the element is contained in the set. Returns true if exists, otherwise returns false

Value parameters

element

tested element

Attributes

Returns

true if exists in the set, otherwise false

Note

Time complexity: O(1)

def remove(element: Elem*): Result[This]

Removes the specified members from the sorted set stored at key. Non existing members are ignored. An error is returned when key exists and does not hold a sorted set.

Removes the specified members from the sorted set stored at key. Non existing members are ignored. An error is returned when key exists and does not hold a sorted set.

Value parameters

element

elements to be removed

Attributes

Returns

the set for chaining calls

Note

Time complexity: O(N) where N is the number of members to be removed.

def toSet: Result[Set[Elem]]

Returns all elements in the set

Returns all elements in the set

Attributes

Returns

all elements in the set

Note

Time complexity: O(N) where N is the set cardinality.

Inherited methods

def isEmpty: Result[Boolean]

Attributes

Inherited from:
RedisCollection (hidden)
def nonEmpty: Result[Boolean]

Attributes

Inherited from:
RedisCollection (hidden)
def size: Result[Long]

Returns the length of the collection stored at key. If key does not exist, it is interpreted as an empty collection and 0 is returned. An error is returned when the value stored at key is not a proper collection.

Returns the length of the collection stored at key. If key does not exist, it is interpreted as an empty collection and 0 is returned. An error is returned when the value stored at key is not a proper collection.

Time complexity: O(1)

Attributes

Returns

size of the list

Inherited from:
RedisCollection (hidden)