Protocol::RedisSourceProtocolRedisMethodsSets

module Sets

Methods for managing Redis 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. See https://redis.io/commands/sadd for more details.

Signature

parameter key Key
parameter member String

Implementation

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

def scard(*arguments)

Get the number of members in a set. O(1). See https://redis.io/commands/scard for more details.

Signature

parameter key Key

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. See https://redis.io/commands/sdiff for more details.

Signature

parameter key Key

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. See https://redis.io/commands/sdiffstore for more details.

Signature

parameter destination Key
parameter key Key

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. See https://redis.io/commands/sinter for more details.

Signature

parameter key Key

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. See https://redis.io/commands/sinterstore for more details.

Signature

parameter destination Key
parameter key Key

Implementation

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

def sismember(*arguments)

Determine if a given value is a member of a set. O(1). See https://redis.io/commands/sismember for more details.

Signature

parameter key Key
parameter member String

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. See https://redis.io/commands/smembers for more details.

Signature

parameter key Key

Implementation

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

def smove(*arguments)

Move a member from one set to another. O(1). See https://redis.io/commands/smove for more details.

Signature

parameter source Key
parameter destination Key
parameter member String

Implementation

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

def spop(*arguments)

Remove and return one or multiple random members from a set. O(1). See https://redis.io/commands/spop for more details.

Signature

parameter key Key
parameter count Integer

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. See https://redis.io/commands/srandmember for more details.

Signature

parameter key Key
parameter count Integer

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. See https://redis.io/commands/srem for more details.

Signature

parameter key Key
parameter member String

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. See https://redis.io/commands/sunion for more details.

Signature

parameter key Key

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. See https://redis.io/commands/sunionstore for more details.

Signature

parameter destination Key
parameter key Key

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.. See https://redis.io/commands/sscan for more details.

Signature

parameter key Key
parameter cursor Integer

Implementation

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