On this page:
redis-set-add!
redis-set-count
redis-set-difference
redis-set-difference!
redis-set-intersect
redis-set-intersect!
redis-set-member?
redis-set-members
redis-set-move!
redis-set-pop!
redis-set-random-ref
redis-set-remove!
redis-set-scan
redis-set-union
redis-set-union!
in-redis-set

15 Set Commands

procedure

(redis-set-add! client key val ...+)  exact-nonnegative-integer?

  client : redis?
  key : redis-key/c
  val : redis-string/c
Adds vals to the set at key.
Commands used by this function: SADD

procedure

(redis-set-count client key)  exact-nonnegative-integer?

  client : redis?
  key : redis-key/c
Returns the number of elements in the set at key.
Commands used by this function: SCARD

procedure

(redis-set-difference client key ...+)  (listof bytes?)

  client : redis?
  key : redis-key/c
Returns the set difference between the sets represented by each key.
Commands used by this function: SDIFF

procedure

(redis-set-difference! client    
  target    
  key ...+)  exact-nonnegative-integer?
  client : redis?
  target : redis-key/c
  key : redis-key/c
Computes the set difference between the sets at each key and stores the result in target, returning the number of elements in the result.
Commands used by this function: SDIFFSTORE

procedure

(redis-set-intersect client key ...+)  (listof bytes?)

  client : redis?
  key : redis-key/c
Returns the set intersection between the sets represented by each key.
Commands used by this function: SINTER

procedure

(redis-set-intersect! client target key ...+)

  exact-nonnegative-integer?
  client : redis?
  target : redis-key/c
  key : redis-key/c
Computes the set intersection between the sets at each key and stores the result in target, returning the number of elements in the result.
Commands used by this function: SINTERSTORE

procedure

(redis-set-member? client key val)  boolean?

  client : redis?
  key : redis-key/c
  val : redis-string/c
Returns #t when val is a member of the set at key.
Commands used by this function: SMEMBER

procedure

(redis-set-members client key)  (listof bytes?)

  client : redis?
  key : redis-key/c
Returns a list containing every member of the set at key.
Commands used by this function: SMEMBERS

procedure

(redis-set-move! client src dst val)  boolean?

  client : redis?
  src : redis-key/c
  dst : redis-key/c
  val : redis-key/c
Moves val from the set at src into the set at dst, returning #t on success.
Commands used by this function: SMOVE

procedure

(redis-set-pop! client key [#:count count])  (listof bytes?)

  client : redis?
  key : redis-key/c
  count : exact-positive-integer? = 1
Removes and subsequently returns at most count elements from the set at key.
Commands used by this function: SPOP

procedure

(redis-set-random-ref client key [count])

  (or/c false/c bytes? (listof bytes?))
  client : redis?
  key : redis-key/c
  count : exact-integer? = 1
Retrieves one or more random elements from the set at key.

When count is provided, a list of results whose size is (abs count) or less will be returned.
Commands used by this function: SRANDMEMBER

procedure

(redis-set-remove! client key val ...+)

  exact-nonnegative-integer?
  client : redis?
  key : redis-key/c
  val : redis-string/c
Removes each val from the set at key, returning the total number of removed elements.
Commands used by this function: SREM

procedure

(redis-set-scan client    
  key    
  [#:cursor cursor    
  #:pattern pattern    
  #:limit limit])  
exact-nonnegative-integer?
(listof redis-string/c)
  client : redis?
  key : redis-key/c
  cursor : exact-nonnegative-integer? = 0
  pattern : (or/c false/c redis-string/c) = #f
  limit : (or/c false/c exact-positive-integer?) = #f
Efficiently iterates through the set of values in the set at key.

The limit parameter serves as a hint for the implementation, but the server may return more items than limit per iteration.
Commands used by this function: SSCAN

procedure

(redis-set-union client key ...+)  (listof bytes?)

  client : redis?
  key : redis-key/c
Returns the set union between the sets represented by each key.
Commands used by this function: SUNION

procedure

(redis-set-union! client target key ...+)

  exact-nonnegative-integer?
  client : redis?
  target : redis-key/c
  key : redis-key/c
Computes the set union between the sets at each key and stores the result in target, returning the number of elements in the result.
Commands used by this function: SUNIONSTORE

procedure

(in-redis-set client key)  (sequenceof bytes?)

  client : redis?
  key : redis-key/c
Returns a sequence that can be used to efficiently iterate through the set at key.

Any keyword arguments that are passed to this function will be forwarded to redis-set-scan.