On this page:
redis-bytes-append!
redis-bytes-bitcount
redis-bytes-bitwise-and!
redis-bytes-bitwise-not!
redis-bytes-bitwise-or!
redis-bytes-bitwise-xor!
redis-bytes-copy!
redis-bytes-decr!
redis-bytes-get
redis-bytes-incr!
redis-bytes-length
redis-bytes-ref/  bit
redis-bytes-set!
redis-bytes-set/  bit!
redis-subbytes

18 String/bytes Commands🔗ℹ

All Redis strings are sequences of bytes, so whereas most of the following functions accept both bytes? and string? values, when a key is retrieved from the server, its value will always be either #f (if it doesn’t exist) or bytes?.

procedure

(redis-bytes-append! client key value)

  exact-nonnegative-integer?
  client : redis?
  key : redis-key/c
  value : redis-string/c
APPENDs value to the byte string at key if it exists and returns the new length of key.
Commands used by this function: APPEND

procedure

(redis-bytes-bitcount client 
  key 
  [#:start start 
  #:stop stop]) 
  exact-nonnegative-integer?
  client : redis?
  key : redis-key/c
  start : exact-integer? = 0
  stop : exact-integer? = -1
Counts the bits in the byte string at key between start and end using BITCOUNT.
Commands used by this function: BITCOUNT

procedure

(redis-bytes-bitwise-and! client dst src ...)

  exact-nonnegative-integer?
  client : redis?
  dst : redis-key/c
  src : redis-key/c
ANDs all the src byte strings together and saves the result into dst, returning the length of the resulting byte string.
Commands used by this function: BITOP

procedure

(redis-bytes-bitwise-not! client src [dst])

  exact-nonnegative-integer?
  client : redis?
  src : redis-key/c
  dst : redis-key/c = src
Flips all the bits in the byte string at src and stores the result in dst, returning the length of the resulting byte string.
Commands used by this function: BITOP

procedure

(redis-bytes-bitwise-or! client dst src ...)

  exact-nonnegative-integer?
  client : redis?
  dst : redis-key/c
  src : redis-key/c
ORs all the src byte strings together and saves the result into dst, returning the length of the resulting byte string.
Commands used by this function: BITOP

procedure

(redis-bytes-bitwise-xor! client dst src ...)

  exact-nonnegative-integer?
  client : redis?
  dst : redis-key/c
  src : redis-key/c
XORs all the src byte strings together and saves the result into dst, returning the length of the resulting byte string.
Commands used by this function: BITOP

procedure

(redis-bytes-copy! client key offset value)

  exact-nonnegative-integer?
  client : redis?
  key : redis-key/c
  offset : exact-nonnegative-integer?
  value : redis-string/c
Writes value into the byte string at key starting at offset, extending the string if necessary. Returns the new length of the string.
Commands used by this function: SETRANGE

procedure

(redis-bytes-decr! client key [amt])  exact-integer?

  client : redis?
  key : redis-key/c
  amt : exact-integer? = 1
Decrements the numeric value of the byte string at key by amt.

If the value at key is not an integer, then the function will raise an exn:fail:redis error.
Commands used by this function: DECR, DECRBY

procedure

(redis-bytes-get client key ...+)  (or/c #f bytes?)

  client : redis?
  key : redis-key/c
Retrieves one or more keys from the database.
Commands used by this function: GET, MGET

procedure

(redis-bytes-incr! client key amt)  real?

  client : redis?
  key : redis-key/c
  amt : real?
Increments the value at key by amt and returns the result.
Commands used by this function: INCR, INCRBY, INCRBYFLOAT

procedure

(redis-bytes-length client key)  exact-nonnegative-integer?

  client : redis?
  key : redis-key/c
Returns the number of bytes in the string at key.
Commands used by this function: STRLEN

procedure

(redis-bytes-ref/bit client key offset)  (or/c 0 1)

  client : redis?
  key : redis-key/c
  offset : exact-nonnegative-integer?
Retrieves the value of the bit at offset within the byte string at key.
Commands used by this function: GETBIT

procedure

(redis-bytes-set! client    
  key    
  value    
  [#:expires-in expires-in    
  #:unless-exists? unless-exists?    
  #:when-exists? when-exists?])  boolean?
  client : redis?
  key : redis-key/c
  value : redis-string/c
  expires-in : (or/c #f exact-nonnegative-integer?) = #f
  unless-exists? : boolean? = #f
  when-exists? : boolean? = #f
SETs key to value. Byte string values are written to the server as-is, strings are converted to byte strings first.

When expires-in is #t, then the key will expire after expires-in milliseconds.

When unless-exists? is #t, then the key will only be set if it doesn’t already exist.

When when-exists? is #t, then the key will only be set if it already exists.
Commands used by this function: SET

procedure

(redis-bytes-set/bit! client    
  key    
  offset    
  value)  (or/c 0 1)
  client : redis?
  key : redis-key/c
  offset : exact-nonnegative-integer?
  value : (or/c 0 1)
Sets the bit at offset within the byte string at key to value and returns the previous bit value at that position.
Commands used by this function: SETBIT

procedure

(redis-subbytes client    
  key    
  [#:start start    
  #:stop stop])  bytes?
  client : redis?
  key : redis-key/c
  start : exact-integer? = 0
  stop : exact-integer? = -1
Returns a substring between the indices start and stop of the byte string at key.
Commands used by this function: GETRANGE