Protocol::Redis SourceProtocolRedisMethodsSets

module Sets

Definitions

def sadd(*arguments)

Add one or more members to a set. O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments.

Implementation

def sadd(*arguments)
	call("SADD", *arguments)
end

def scard(*arguments)

Get the number of members in a set. O(1).

Implementation

def scard(*arguments)
	call("SCARD", *arguments)
end

def sdiff(*arguments)

Subtract multiple sets. O(N) where N is the total number of elements in all given sets.

Implementation

def sdiff(*arguments)
	call("SDIFF", *arguments)
end

def sdiffstore(*arguments)

Subtract multiple sets and store the resulting set in a key. O(N) where N is the total number of elements in all given sets.

Implementation

def sdiffstore(*arguments)
	call("SDIFFSTORE", *arguments)
end

def sinter(*arguments)

Intersect multiple sets. O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets.

Implementation

def sinter(*arguments)
	call("SINTER", *arguments)
end

def sinterstore(*arguments)

Intersect multiple sets and store the resulting set in a key. O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets.

Implementation

def sinterstore(*arguments)
	call("SINTERSTORE", *arguments)
end

def sismember(*arguments)

Determine if a given value is a member of a set. O(1).

Implementation

def sismember(*arguments)
	call("SISMEMBER", *arguments)
end

def smembers(*arguments)

Get all the members in a set. O(N) where N is the set cardinality.

Implementation

def smembers(*arguments)
	call("SMEMBERS", *arguments)
end

def smove(*arguments)

Move a member from one set to another. O(1).

Implementation

def smove(*arguments)
	call("SMOVE", *arguments)
end

def spop(*arguments)

Remove and return one or multiple random members from a set. O(1).

Implementation

def spop(*arguments)
	call("SPOP", *arguments)
end

def srandmember(*arguments)

Get one or multiple random members from a set. Without the count argument O(1), otherwise O(N) where N is the absolute value of the passed count.

Implementation

def srandmember(*arguments)
	call("SRANDMEMBER", *arguments)
end

def srem(*arguments)

Remove one or more members from a set. O(N) where N is the number of members to be removed.

Implementation

def srem(*arguments)
	call("SREM", *arguments)
end

def sunion(*arguments)

Add multiple sets. O(N) where N is the total number of elements in all given sets.

Implementation

def sunion(*arguments)
	call("SUNION", *arguments)
end

def sunionstore(*arguments)

Add multiple sets and store the resulting set in a key. O(N) where N is the total number of elements in all given sets.

Implementation

def sunionstore(*arguments)
	call("SUNIONSTORE", *arguments)
end

def sscan(*arguments)

Incrementally iterate Set elements. O(1) for every call. O(N) for a complete iteration, including enough command calls for the cursor to return back to 0. N is the number of elements inside the collection..

Implementation

def sscan(*arguments)
	call("SSCAN", *arguments)
end