module Protocol::Redis::Methods::Sets

Public Instance Methods

sadd(*arguments) click to toggle source

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 redis.io/commands/sadd @param key [Key] @param member [String]

# File lib/protocol/redis/methods/sets.rb, line 31
def sadd(*arguments)
        call("SADD", *arguments)
end
scard(*arguments) click to toggle source

Get the number of members in a set. O(1). @see redis.io/commands/scard @param key [Key]

# File lib/protocol/redis/methods/sets.rb, line 38
def scard(*arguments)
        call("SCARD", *arguments)
end
sdiff(*arguments) click to toggle source

Subtract multiple sets. O(N) where N is the total number of elements in all given sets. @see redis.io/commands/sdiff @param key [Key]

# File lib/protocol/redis/methods/sets.rb, line 45
def sdiff(*arguments)
        call("SDIFF", *arguments)
end
sdiffstore(*arguments) click to toggle source

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 redis.io/commands/sdiffstore @param destination [Key] @param key [Key]

# File lib/protocol/redis/methods/sets.rb, line 53
def sdiffstore(*arguments)
        call("SDIFFSTORE", *arguments)
end
sinter(*arguments) click to toggle source

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 redis.io/commands/sinter @param key [Key]

# File lib/protocol/redis/methods/sets.rb, line 60
def sinter(*arguments)
        call("SINTER", *arguments)
end
sinterstore(*arguments) click to toggle source

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 redis.io/commands/sinterstore @param destination [Key] @param key [Key]

# File lib/protocol/redis/methods/sets.rb, line 68
def sinterstore(*arguments)
        call("SINTERSTORE", *arguments)
end
sismember(*arguments) click to toggle source

Determine if a given value is a member of a set. O(1). @see redis.io/commands/sismember @param key [Key] @param member [String]

# File lib/protocol/redis/methods/sets.rb, line 76
def sismember(*arguments)
        call("SISMEMBER", *arguments)
end
smembers(*arguments) click to toggle source

Get all the members in a set. O(N) where N is the set cardinality. @see redis.io/commands/smembers @param key [Key]

# File lib/protocol/redis/methods/sets.rb, line 83
def smembers(*arguments)
        call("SMEMBERS", *arguments)
end
smove(*arguments) click to toggle source

Move a member from one set to another. O(1). @see redis.io/commands/smove @param source [Key] @param destination [Key] @param member [String]

# File lib/protocol/redis/methods/sets.rb, line 92
def smove(*arguments)
        call("SMOVE", *arguments)
end
spop(*arguments) click to toggle source

Remove and return one or multiple random members from a set. O(1). @see redis.io/commands/spop @param key [Key] @param count [Integer]

# File lib/protocol/redis/methods/sets.rb, line 100
def spop(*arguments)
        call("SPOP", *arguments)
end
srandmember(*arguments) click to toggle source

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 redis.io/commands/srandmember @param key [Key] @param count [Integer]

# File lib/protocol/redis/methods/sets.rb, line 108
def srandmember(*arguments)
        call("SRANDMEMBER", *arguments)
end
srem(*arguments) click to toggle source

Remove one or more members from a set. O(N) where N is the number of members to be removed. @see redis.io/commands/srem @param key [Key] @param member [String]

# File lib/protocol/redis/methods/sets.rb, line 116
def srem(*arguments)
        call("SREM", *arguments)
end
sscan(*arguments) click to toggle source

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 redis.io/commands/sscan @param key [Key] @param cursor [Integer]

# File lib/protocol/redis/methods/sets.rb, line 139
def sscan(*arguments)
        call("SSCAN", *arguments)
end
sunion(*arguments) click to toggle source

Add multiple sets. O(N) where N is the total number of elements in all given sets. @see redis.io/commands/sunion @param key [Key]

# File lib/protocol/redis/methods/sets.rb, line 123
def sunion(*arguments)
        call("SUNION", *arguments)
end
sunionstore(*arguments) click to toggle source

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 redis.io/commands/sunionstore @param destination [Key] @param key [Key]

# File lib/protocol/redis/methods/sets.rb, line 131
def sunionstore(*arguments)
        call("SUNIONSTORE", *arguments)
end