taoensso.carmine
Clojure Redis client & message queue.
-call-with-new-listener
(-call-with-new-listener {:keys [conn-spec init-state handler-fn body-fn]})
Implementation detail. Returns new Listener.
-call-with-new-pubsub-listener
(-call-with-new-pubsub-listener {:keys [conn-spec handler body-fn]})
acl
(acl arg1)
(acl arg1 & args)
`ACL` - Redis command function.
Available since: Redis 6.0.0
Complexity: Depends on subcommand.
A container for Access List Control commands.
Ref. https://redis.io/commands/acl/ for more info.
acl-cat
(acl-cat)
(acl-cat & args)
`ACL CAT` - Redis command function.
Available since: Redis 6.0.0
Complexity: O(1) since the categories and commands are a fixed set.
Lists the ACL categories, or the commands inside a category.
Ref. https://redis.io/commands/acl-cat/ for more info.
acl-deluser
(acl-deluser username)
(acl-deluser username & args)
`ACL DELUSER` - Redis command function.
Available since: Redis 6.0.0
Complexity: O(1) amortized time considering the typical user.
Deletes ACL users, and terminates their connections.
Ref. https://redis.io/commands/acl-deluser/ for more info.
acl-dryrun
(acl-dryrun username command)
(acl-dryrun username command & args)
`ACL DRYRUN` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(1).
Simulates the execution of a command by a user, without executing the command.
Ref. https://redis.io/commands/acl-dryrun/ for more info.
acl-genpass
(acl-genpass)
(acl-genpass & args)
`ACL GENPASS` - Redis command function.
Available since: Redis 6.0.0
Complexity: O(1)
Generates a pseudorandom, secure password that can be used to identify ACL users.
Ref. https://redis.io/commands/acl-genpass/ for more info.
acl-getuser
(acl-getuser username)
`ACL GETUSER` - Redis command function.
Available since: Redis 6.0.0
Complexity: O(N). Where N is the number of password, command and pattern rules that the user has.
Lists the ACL rules of a user.
Ref. https://redis.io/commands/acl-getuser/ for more info.
acl-help
(acl-help)
`ACL HELP` - Redis command function.
Available since: Redis 6.0.0
Complexity: O(1)
Returns helpful text about the different subcommands.
Ref. https://redis.io/commands/acl-help/ for more info.
acl-list
(acl-list)
`ACL LIST` - Redis command function.
Available since: Redis 6.0.0
Complexity: O(N). Where N is the number of configured users.
Dumps the effective rules in ACL file format.
Ref. https://redis.io/commands/acl-list/ for more info.
acl-load
(acl-load)
`ACL LOAD` - Redis command function.
Available since: Redis 6.0.0
Complexity: O(N). Where N is the number of configured users.
Reloads the rules from the configured ACL file.
Ref. https://redis.io/commands/acl-load/ for more info.
acl-log
(acl-log)
(acl-log & args)
`ACL LOG` - Redis command function.
Available since: Redis 6.0.0
Complexity: O(N) with N being the number of entries shown.
Lists recent security events generated due to ACL rules.
Ref. https://redis.io/commands/acl-log/ for more info.
acl-save
(acl-save)
`ACL SAVE` - Redis command function.
Available since: Redis 6.0.0
Complexity: O(N). Where N is the number of configured users.
Saves the effective ACL rules in the configured ACL file.
Ref. https://redis.io/commands/acl-save/ for more info.
acl-setuser
(acl-setuser username)
(acl-setuser username & args)
`ACL SETUSER` - Redis command function.
Available since: Redis 6.0.0
Complexity: O(N). Where N is the number of rules provided.
Creates and modifies an ACL user and its rules.
Ref. https://redis.io/commands/acl-setuser/ for more info.
acl-users
(acl-users)
`ACL USERS` - Redis command function.
Available since: Redis 6.0.0
Complexity: O(N). Where N is the number of configured users.
Lists all ACL users.
Ref. https://redis.io/commands/acl-users/ for more info.
acl-whoami
(acl-whoami)
`ACL WHOAMI` - Redis command function.
Available since: Redis 6.0.0
Complexity: O(1)
Returns the authenticated username of the current connection.
Ref. https://redis.io/commands/acl-whoami/ for more info.
append
(append key value)
`APPEND` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(1). The amortized time complexity is O(1) assuming the appended value is small and the already present value is of any size, since the dynamic string library used by Redis will double the free space available on every reallocation.
Appends a string to the value of a key. Creates the key if it doesn't exist.
Ref. https://redis.io/commands/append/ for more info.
as-double
deprecated
DEPRECATED: Use `as-float` instead.
as-long
deprecated
DEPRECATED: Use `as-int` instead.
as-map
(as-map x)
(as-map x & [kf vf])
asking
(asking)
`ASKING` - Redis command function.
Available since: Redis 3.0.0
Complexity: O(1)
Signals that a cluster client is following an -ASK redirect.
Ref. https://redis.io/commands/asking/ for more info.
atomic
macro
(atomic conn-opts max-cas-attempts & body)
Alpha - subject to change!
Tool to ease Redis transactions for fun & profit. Wraps body in a `wcar`
call that terminates with `exec`, cleans up reply, and supports automatic
retry for failed optimistic locking.
Body must contain a `multi` call and may contain calls to: `watch`, `unwatch`,
`discard`, etc. Ref. http://redis.io/topics/transactions for more info.
`return` and `parse` NOT supported after `multi` has been called.
Like `swap!` fn, body may be called multiple times so should avoid impure or
expensive ops.
;;; Atomically increment integer key without using INCR
(atomic {} 100 ; Retry <= 100 times on failed optimistic lock, or throw ex
(watch :my-int-key) ; Watch key for changes
(let [;; You can grab the value of the watched key using
;; `with-replies` (on the current connection), or
;; a nested `wcar` (on a new connection):
curr-val (or (as-long (with-replies (get :my-int-key))) 0)]
(return curr-val)
(multi) ; Start the transaction
(set :my-int-key (inc curr-val))
(get :my-int-key)
))
=> [["OK" nil "OK" "QUEUED" "QUEUED"] ; Prelude replies
["OK" "1"] ; Transaction replies (`exec` reply)
]
See also `lua` as alternative way to get transactional behaviour.
atomic*
macro
(atomic* conn-opts max-cas-attempts on-success on-failure)
Alpha - subject to change. Low-level transaction util.
atomically
macro
deprecated
(atomically watch-keys & body)
DEPRECATED: Use `atomic` instead.
auth
(auth arg1)
(auth arg1 & args)
`AUTH` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N) where N is the number of passwords defined for the user
Authenticates the connection.
Ref. https://redis.io/commands/auth/ for more info.
bgrewriteaof
(bgrewriteaof)
`BGREWRITEAOF` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Asynchronously rewrites the append-only file to disk.
Ref. https://redis.io/commands/bgrewriteaof/ for more info.
bgsave
(bgsave)
(bgsave & args)
`BGSAVE` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Asynchronously saves the database(s) to disk.
Ref. https://redis.io/commands/bgsave/ for more info.
bitcount
(bitcount key)
(bitcount key & args)
`BITCOUNT` - Redis command function.
Available since: Redis 2.6.0
Complexity: O(N)
Counts the number of set bits (population counting) in a string.
Ref. https://redis.io/commands/bitcount/ for more info.
bitfield
(bitfield key)
(bitfield key & args)
`BITFIELD` - Redis command function.
Available since: Redis 3.2.0
Complexity: O(1) for each subcommand specified
Performs arbitrary bitfield integer operations on strings.
Ref. https://redis.io/commands/bitfield/ for more info.
bitfield_ro
(bitfield_ro key)
(bitfield_ro key & args)
`BITFIELD_RO` - Redis command function.
Available since: Redis 6.0.0
Complexity: O(1) for each subcommand specified
Performs arbitrary read-only bitfield integer operations on strings.
Ref. https://redis.io/commands/bitfield_ro/ for more info.
bitop
(bitop arg1 arg2 arg3)
(bitop arg1 arg2 arg3 & args)
`BITOP` - Redis command function.
Available since: Redis 2.6.0
Complexity: O(N)
Performs bitwise operations on multiple strings, and stores the result.
Ref. https://redis.io/commands/bitop/ for more info.
bitpos
(bitpos key bit)
(bitpos key bit & args)
`BITPOS` - Redis command function.
Available since: Redis 2.8.7
Complexity: O(N)
Finds the first set (1) or clear (0) bit in a string.
Ref. https://redis.io/commands/bitpos/ for more info.
blmove
(blmove source destination arg1 arg2 arg3)
`BLMOVE` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(1)
Pops an element from a list, pushes it to another list and returns it. Blocks until an element is available otherwise. Deletes the list if the last element was moved.
Ref. https://redis.io/commands/blmove/ for more info.
blmpop
(blmpop timeout numkeys key arg1)
(blmpop timeout numkeys key arg1 & args)
`BLMPOP` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N+M) where N is the number of provided keys and M is the number of elements returned.
Pops the first element from one of multiple lists. Blocks until an element is available otherwise. Deletes the list if the last element was popped.
Ref. https://redis.io/commands/blmpop/ for more info.
blpop
(blpop key arg1)
(blpop key arg1 & args)
`BLPOP` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(N) where N is the number of provided keys.
Removes and returns the first element in a list. Blocks until an element is available otherwise. Deletes the list if the last element was popped.
Ref. https://redis.io/commands/blpop/ for more info.
brpop
(brpop key arg1)
(brpop key arg1 & args)
`BRPOP` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(N) where N is the number of provided keys.
Removes and returns the last element in a list. Blocks until an element is available otherwise. Deletes the list if the last element was popped.
Ref. https://redis.io/commands/brpop/ for more info.
brpoplpush
(brpoplpush source destination timeout)
`BRPOPLPUSH` - Redis command function.
Available since: Redis 2.2.0
Complexity: O(1)
Pops an element from a list, pushes it to another list and returns it. Block until an element is available otherwise. Deletes the list if the last element was popped.
Ref. https://redis.io/commands/brpoplpush/ for more info.
bzmpop
(bzmpop timeout numkeys key arg1)
(bzmpop timeout numkeys key arg1 & args)
`BZMPOP` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(K) + O(M*log(N)) where K is the number of provided keys, N being the number of elements in the sorted set, and M being the number of elements popped.
Removes and returns a member by score from one or more sorted sets. Blocks until a member is available otherwise. Deletes the sorted set if the last element was popped.
Ref. https://redis.io/commands/bzmpop/ for more info.
bzpopmax
(bzpopmax key arg1)
(bzpopmax key arg1 & args)
`BZPOPMAX` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(log(N)) with N being the number of elements in the sorted set.
Removes and returns the member with the highest score from one or more sorted sets. Blocks until a member available otherwise. Deletes the sorted set if the last element was popped.
Ref. https://redis.io/commands/bzpopmax/ for more info.
bzpopmin
(bzpopmin key arg1)
(bzpopmin key arg1 & args)
`BZPOPMIN` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(log(N)) with N being the number of elements in the sorted set.
Removes and returns the member with the lowest score from one or more sorted sets. Blocks until a member is available otherwise. Deletes the sorted set if the last element was popped.
Ref. https://redis.io/commands/bzpopmin/ for more info.
client
(client arg1)
(client arg1 & args)
`CLIENT` - Redis command function.
Available since: Redis 2.4.0
Complexity: Depends on subcommand.
A container for client connection commands.
Ref. https://redis.io/commands/client/ for more info.
client-caching
(client-caching arg1)
`CLIENT CACHING` - Redis command function.
Available since: Redis 6.0.0
Complexity: O(1)
Instructs the server whether to track the keys in the next request.
Ref. https://redis.io/commands/client-caching/ for more info.
client-getname
(client-getname)
client-getredir
(client-getredir)
`CLIENT GETREDIR` - Redis command function.
Available since: Redis 6.0.0
Complexity: O(1)
Returns the client ID to which the connection's tracking notifications are redirected.
Ref. https://redis.io/commands/client-getredir/ for more info.
client-help
(client-help)
`CLIENT HELP` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(1)
Returns helpful text about the different subcommands.
Ref. https://redis.io/commands/client-help/ for more info.
client-id
(client-id)
`CLIENT ID` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(1)
Returns the unique client ID of the connection.
Ref. https://redis.io/commands/client-id/ for more info.
client-kill
(client-kill arg1)
(client-kill arg1 & args)
`CLIENT KILL` - Redis command function.
Available since: Redis 2.4.0
Complexity: O(N) where N is the number of client connections
Terminates open connections.
Ref. https://redis.io/commands/client-kill/ for more info.
client-list
(client-list)
(client-list & args)
`CLIENT LIST` - Redis command function.
Available since: Redis 2.4.0
Complexity: O(N) where N is the number of client connections
Lists open connections.
Ref. https://redis.io/commands/client-list/ for more info.
client-no-evict
(client-no-evict arg1)
client-no-touch
(client-no-touch arg1)
`CLIENT NO-TOUCH` - Redis command function.
Available since: Redis 7.2.0
Complexity: O(1)
Controls whether commands sent by the client affect the LRU/LFU of accessed keys.
Ref. https://redis.io/commands/client-no-touch/ for more info.
client-pause
(client-pause timeout)
(client-pause timeout & args)
client-reply
(client-reply arg1)
`CLIENT REPLY` - Redis command function.
Available since: Redis 3.2.0
Complexity: O(1)
Instructs the server whether to reply to commands.
Ref. https://redis.io/commands/client-reply/ for more info.
client-setinfo
(client-setinfo arg1 arg2)
`CLIENT SETINFO` - Redis command function.
Available since: Redis 7.2.0
Complexity: O(1)
Sets information specific to the client or connection.
Ref. https://redis.io/commands/client-setinfo/ for more info.
client-setname
(client-setname connection-name)
client-tracking
(client-tracking arg1)
(client-tracking arg1 & args)
`CLIENT TRACKING` - Redis command function.
Available since: Redis 6.0.0
Complexity: O(1). Some options may introduce additional complexity.
Controls server-assisted client-side caching for the connection.
Ref. https://redis.io/commands/client-tracking/ for more info.
client-trackinginfo
(client-trackinginfo)
`CLIENT TRACKINGINFO` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(1)
Returns information about server-assisted client-side caching for the connection.
Ref. https://redis.io/commands/client-trackinginfo/ for more info.
client-unblock
(client-unblock client-id)
(client-unblock client-id & args)
`CLIENT UNBLOCK` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(log N) where N is the number of client connections
Unblocks a client blocked by a blocking command from a different connection.
Ref. https://redis.io/commands/client-unblock/ for more info.
client-unpause
(client-unpause)
`CLIENT UNPAUSE` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(N) Where N is the number of paused clients
Resumes processing commands from paused clients.
Ref. https://redis.io/commands/client-unpause/ for more info.
close-listener
(close-listener listener)
cluster
(cluster arg1)
(cluster arg1 & args)
`CLUSTER` - Redis command function.
Available since: Redis 3.0.0
Complexity: Depends on subcommand.
A container for Redis Cluster commands.
Ref. https://redis.io/commands/cluster/ for more info.
cluster-addslots
(cluster-addslots slot)
(cluster-addslots slot & args)
`CLUSTER ADDSLOTS` - Redis command function.
Available since: Redis 3.0.0
Complexity: O(N) where N is the total number of hash slot arguments
Assigns new hash slots to a node.
Ref. https://redis.io/commands/cluster-addslots/ for more info.
cluster-addslotsrange
(cluster-addslotsrange arg1 arg2)
(cluster-addslotsrange arg1 arg2 & args)
`CLUSTER ADDSLOTSRANGE` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N) where N is the total number of the slots between the start slot and end slot arguments.
Assigns new hash slot ranges to a node.
Ref. https://redis.io/commands/cluster-addslotsrange/ for more info.
cluster-bumpepoch
(cluster-bumpepoch)
cluster-count-failure-reports
(cluster-count-failure-reports node-id)
`CLUSTER COUNT-FAILURE-REPORTS` - Redis command function.
Available since: Redis 3.0.0
Complexity: O(N) where N is the number of failure reports
Returns the number of active failure reports active for a node.
Ref. https://redis.io/commands/cluster-count-failure-reports/ for more info.
cluster-countkeysinslot
(cluster-countkeysinslot slot)
cluster-delslots
(cluster-delslots slot)
(cluster-delslots slot & args)
`CLUSTER DELSLOTS` - Redis command function.
Available since: Redis 3.0.0
Complexity: O(N) where N is the total number of hash slot arguments
Sets hash slots as unbound for a node.
Ref. https://redis.io/commands/cluster-delslots/ for more info.
cluster-delslotsrange
(cluster-delslotsrange arg1 arg2)
(cluster-delslotsrange arg1 arg2 & args)
`CLUSTER DELSLOTSRANGE` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N) where N is the total number of the slots between the start slot and end slot arguments.
Sets hash slot ranges as unbound for a node.
Ref. https://redis.io/commands/cluster-delslotsrange/ for more info.
cluster-failover
(cluster-failover)
(cluster-failover & args)
`CLUSTER FAILOVER` - Redis command function.
Available since: Redis 3.0.0
Complexity: O(1)
Forces a replica to perform a manual failover of its master.
Ref. https://redis.io/commands/cluster-failover/ for more info.
cluster-flushslots
(cluster-flushslots)
cluster-forget
(cluster-forget node-id)
cluster-getkeysinslot
(cluster-getkeysinslot slot count)
`CLUSTER GETKEYSINSLOT` - Redis command function.
Available since: Redis 3.0.0
Complexity: O(N) where N is the number of requested keys
Returns the key names in a hash slot.
Ref. https://redis.io/commands/cluster-getkeysinslot/ for more info.
cluster-help
(cluster-help)
`CLUSTER HELP` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(1)
Returns helpful text about the different subcommands.
Ref. https://redis.io/commands/cluster-help/ for more info.
cluster-info
(cluster-info)
cluster-keyslot
(cluster-keyslot key)
`CLUSTER KEYSLOT` - Redis command function.
Available since: Redis 3.0.0
Complexity: O(N) where N is the number of bytes in the key
Returns the hash slot for a key.
Ref. https://redis.io/commands/cluster-keyslot/ for more info.
cluster-links
(cluster-links)
`CLUSTER LINKS` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N) where N is the total number of Cluster nodes
Returns a list of all TCP links to and from peer nodes.
Ref. https://redis.io/commands/cluster-links/ for more info.
cluster-meet
(cluster-meet ip port)
(cluster-meet ip port & args)
cluster-myid
(cluster-myid)
cluster-myshardid
(cluster-myshardid)
cluster-nodes
(cluster-nodes)
`CLUSTER NODES` - Redis command function.
Available since: Redis 3.0.0
Complexity: O(N) where N is the total number of Cluster nodes
Returns the cluster configuration for a node.
Ref. https://redis.io/commands/cluster-nodes/ for more info.
cluster-replicas
(cluster-replicas node-id)
`CLUSTER REPLICAS` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(N) where N is the number of replicas.
Lists the replica nodes of a master node.
Ref. https://redis.io/commands/cluster-replicas/ for more info.
cluster-replicate
(cluster-replicate node-id)
cluster-reset
(cluster-reset)
(cluster-reset & args)
`CLUSTER RESET` - Redis command function.
Available since: Redis 3.0.0
Complexity: O(N) where N is the number of known nodes. The command may execute a FLUSHALL as a side effect.
Resets a node.
Ref. https://redis.io/commands/cluster-reset/ for more info.
cluster-saveconfig
(cluster-saveconfig)
cluster-set-config-epoch
(cluster-set-config-epoch config-epoch)
cluster-setslot
(cluster-setslot slot arg1)
(cluster-setslot slot arg1 & args)
cluster-shards
(cluster-shards)
`CLUSTER SHARDS` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N) where N is the total number of cluster nodes
Returns the mapping of cluster slots to shards.
Ref. https://redis.io/commands/cluster-shards/ for more info.
cluster-slaves
(cluster-slaves node-id)
`CLUSTER SLAVES` - Redis command function.
Available since: Redis 3.0.0
Complexity: O(N) where N is the number of replicas.
Lists the replica nodes of a master node.
Ref. https://redis.io/commands/cluster-slaves/ for more info.
cluster-slots
(cluster-slots)
`CLUSTER SLOTS` - Redis command function.
Available since: Redis 3.0.0
Complexity: O(N) where N is the total number of Cluster nodes
Returns the mapping of cluster slots to nodes.
Ref. https://redis.io/commands/cluster-slots/ for more info.
command
(command)
(command & args)
`COMMAND` - Redis command function.
Available since: Redis 2.8.13
Complexity: O(N) where N is the total number of Redis commands
Returns detailed information about all commands.
Ref. https://redis.io/commands/command/ for more info.
command-count
(command-count)
command-docs
(command-docs)
(command-docs & args)
`COMMAND DOCS` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N) where N is the number of commands to look up
Returns documentary information about one, multiple or all commands.
Ref. https://redis.io/commands/command-docs/ for more info.
command-getkeys
(command-getkeys command)
(command-getkeys command & args)
`COMMAND GETKEYS` - Redis command function.
Available since: Redis 2.8.13
Complexity: O(N) where N is the number of arguments to the command
Extracts the key names from an arbitrary command.
Ref. https://redis.io/commands/command-getkeys/ for more info.
command-getkeysandflags
(command-getkeysandflags command)
(command-getkeysandflags command & args)
`COMMAND GETKEYSANDFLAGS` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N) where N is the number of arguments to the command
Extracts the key names and access flags for an arbitrary command.
Ref. https://redis.io/commands/command-getkeysandflags/ for more info.
command-help
(command-help)
`COMMAND HELP` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(1)
Returns helpful text about the different subcommands.
Ref. https://redis.io/commands/command-help/ for more info.
command-info
(command-info)
(command-info & args)
`COMMAND INFO` - Redis command function.
Available since: Redis 2.8.13
Complexity: O(N) where N is the number of commands to look up
Returns information about one, multiple or all commands.
Ref. https://redis.io/commands/command-info/ for more info.
command-list
(command-list)
(command-list & args)
`COMMAND LIST` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N) where N is the total number of Redis commands
Returns a list of command names.
Ref. https://redis.io/commands/command-list/ for more info.
compare-and-hset
(compare-and-hset k field old-val new-val)
(compare-and-hset k field old-val ?sha new-val)
compare-and-set
(compare-and-set k old-val new-val)
(compare-and-set k old-val ?sha new-val)
config
(config arg1)
(config arg1 & args)
`CONFIG` - Redis command function.
Available since: Redis 2.0.0
Complexity: Depends on subcommand.
A container for server configuration commands.
Ref. https://redis.io/commands/config/ for more info.
config-get
(config-get parameter)
(config-get parameter & args)
`CONFIG GET` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(N) when N is the number of configuration parameters provided
Returns the effective values of configuration parameters.
Ref. https://redis.io/commands/config-get/ for more info.
config-help
(config-help)
`CONFIG HELP` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(1)
Returns helpful text about the different subcommands.
Ref. https://redis.io/commands/config-help/ for more info.
config-resetstat
(config-resetstat)
config-rewrite
(config-rewrite)
config-set
(config-set arg1 arg2)
(config-set arg1 arg2 & args)
`CONFIG SET` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(N) when N is the number of configuration parameters provided
Sets configuration parameters in-flight.
Ref. https://redis.io/commands/config-set/ for more info.
connection-pool
(connection-pool pool-opts)
Returns a new, stateful connection pool for use with `wcar`.
Backed by Apache Commons Pool 2's `GenericKeyedObjectPool`.
Pool opts include:
- :test-on-borrow? ; Test conn health on acquisition from pool? (Default false)
- :test-on-return? ; Test conn health on return to pool? (Default false)
- :test-on-idle? ; Test conn health while idle in pool? (Default true)
- :min-idle-per-key ; Min num of idle conns to keep per sub-pool (Default 0)
- :max-idle-per-key ; Max num of idle conns to keep per sub-pool (Default 16)
- :max-total-per-key ; Max num of idle or active conns <...> (Default 16)
Pool can be shutdown with the `java.io.Closeable` `close` method.
This will in turn call the `GenericKeyedObjectPool`'s `close` method.
Example:
(defonce my-pool (car/connection-pool {:test-on-borrow? true})) ; Create pool
(wcar {:pool my-pool} (car/ping)) ; Use pool
(.close my-pool) ; Initiate permanent shutdown of pool
;; Note: pool shutdown does NOT interrupt active connections.
;; It will prevent any new connections, and will destroy any idle or
;; returned connections.
copy
(copy source destination)
(copy source destination & args)
`COPY` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(N) worst case for collections, where N is the number of nested items. O(1) for string values.
Copies the value of a key to a new key.
Ref. https://redis.io/commands/copy/ for more info.
dbsize
(dbsize)
`DBSIZE` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Returns the number of keys in the database.
Ref. https://redis.io/commands/dbsize/ for more info.
debug
(debug arg1)
(debug arg1 & args)
`DEBUG` - Redis command function.
Available since: Redis 1.0.0
Complexity: Depends on subcommand.
A container for debugging commands.
Ref. https://redis.io/commands/debug/ for more info.
decr
(decr key)
`DECR` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Decrements the integer value of a key by one. Uses 0 as initial value if the key doesn't exist.
Ref. https://redis.io/commands/decr/ for more info.
decrby
(decrby key decrement)
`DECRBY` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Decrements a number from the integer value of a key. Uses 0 as initial value if the key doesn't exist.
Ref. https://redis.io/commands/decrby/ for more info.
del
(del key)
(del key & args)
`DEL` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N) where N is the number of keys that will be removed. When a key to remove holds a value other than a string, the individual complexity for this key is O(M) where M is the number of elements in the list, set, sorted set or hash. Removing a single key that holds a string value is O(1).
Deletes one or more keys.
Ref. https://redis.io/commands/del/ for more info.
discard
(discard)
`DISCARD` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(N), when N is the number of queued commands
Discards a transaction.
Ref. https://redis.io/commands/discard/ for more info.
dump
(dump key)
`DUMP` - Redis command function.
Available since: Redis 2.6.0
Complexity: O(1) to access the key and additional O(N*M) to serialize it, where N is the number of Redis objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1*M) where M is small, so simply O(1).
Returns a serialized representation of the value stored at a key.
Ref. https://redis.io/commands/dump/ for more info.
echo
(echo message)
`ECHO` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Returns the given string.
Ref. https://redis.io/commands/echo/ for more info.
ensure-atomically
macro
deprecated
(ensure-atomically {:keys [max-tries], :or {max-tries 100}} watch-keys & body)
DEPRECATED: Use `atomic` instead.
eval
(eval script numkeys)
(eval script numkeys & args)
`EVAL` - Redis command function.
Available since: Redis 2.6.0
Complexity: Depends on the script that is executed.
Executes a server-side Lua script.
Ref. https://redis.io/commands/eval/ for more info.
eval*
(eval* script numkeys & args)
Optimistically tries to send `evalsha` command for given script. In the event
of a "NOSCRIPT" reply, reattempts with `eval`. Returns the final command's
reply. Redis Cluster note: keys need to all be on same shard.
eval_ro
(eval_ro script numkeys)
(eval_ro script numkeys & args)
`EVAL_RO` - Redis command function.
Available since: Redis 7.0.0
Complexity: Depends on the script that is executed.
Executes a read-only server-side Lua script.
Ref. https://redis.io/commands/eval_ro/ for more info.
evalsha
(evalsha sha1 numkeys)
(evalsha sha1 numkeys & args)
`EVALSHA` - Redis command function.
Available since: Redis 2.6.0
Complexity: Depends on the script that is executed.
Executes a server-side Lua script by SHA1 digest.
Ref. https://redis.io/commands/evalsha/ for more info.
evalsha*
(evalsha* script numkeys & args)
Like `evalsha` but automatically computes SHA1 hash for script.
evalsha_ro
(evalsha_ro sha1 numkeys)
(evalsha_ro sha1 numkeys & args)
`EVALSHA_RO` - Redis command function.
Available since: Redis 7.0.0
Complexity: Depends on the script that is executed.
Executes a read-only server-side Lua script by SHA1 digest.
Ref. https://redis.io/commands/evalsha_ro/ for more info.
exec
(exec)
`EXEC` - Redis command function.
Available since: Redis 1.2.0
Complexity: Depends on commands in the transaction
Executes all commands in a transaction.
Ref. https://redis.io/commands/exec/ for more info.
exists
(exists key)
(exists key & args)
`EXISTS` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N) where N is the number of keys to check.
Determines whether one or more keys exist.
Ref. https://redis.io/commands/exists/ for more info.
expire
(expire key seconds)
(expire key seconds & args)
`EXPIRE` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Sets the expiration time of a key in seconds.
Ref. https://redis.io/commands/expire/ for more info.
expireat
(expireat key unix-time-seconds)
(expireat key unix-time-seconds & args)
`EXPIREAT` - Redis command function.
Available since: Redis 1.2.0
Complexity: O(1)
Sets the expiration time of a key to a Unix timestamp.
Ref. https://redis.io/commands/expireat/ for more info.
expiretime
(expiretime key)
`EXPIRETIME` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(1)
Returns the expiration time of a key as a Unix timestamp.
Ref. https://redis.io/commands/expiretime/ for more info.
failover
(failover)
(failover & args)
`FAILOVER` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(1)
Starts a coordinated failover from a server to one of its replicas.
Ref. https://redis.io/commands/failover/ for more info.
fcall
(fcall function numkeys)
(fcall function numkeys & args)
`FCALL` - Redis command function.
Available since: Redis 7.0.0
Complexity: Depends on the function that is executed.
Invokes a function.
Ref. https://redis.io/commands/fcall/ for more info.
fcall_ro
(fcall_ro function numkeys)
(fcall_ro function numkeys & args)
`FCALL_RO` - Redis command function.
Available since: Redis 7.0.0
Complexity: Depends on the function that is executed.
Invokes a read-only function.
Ref. https://redis.io/commands/fcall_ro/ for more info.
flushall
(flushall)
(flushall & args)
`FLUSHALL` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N) where N is the total number of keys in all databases
Removes all keys from all databases.
Ref. https://redis.io/commands/flushall/ for more info.
flushdb
(flushdb)
(flushdb & args)
`FLUSHDB` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N) where N is the number of keys in the selected database
Remove all keys from the current database.
Ref. https://redis.io/commands/flushdb/ for more info.
freeze
(freeze x)
(freeze x wrap-opts)
Forces argument of any type (incl. keywords, simple numbers, and binary types)
to be subject to automatic de/serialization with Nippy.
function
(function arg1)
(function arg1 & args)
`FUNCTION` - Redis command function.
Available since: Redis 7.0.0
Complexity: Depends on subcommand.
A container for function commands.
Ref. https://redis.io/commands/function/ for more info.
function-delete
(function-delete library-name)
function-dump
(function-dump)
`FUNCTION DUMP` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N) where N is the number of functions
Dumps all libraries into a serialized binary payload.
Ref. https://redis.io/commands/function-dump/ for more info.
function-flush
(function-flush)
(function-flush & args)
`FUNCTION FLUSH` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N) where N is the number of functions deleted
Deletes all libraries and functions.
Ref. https://redis.io/commands/function-flush/ for more info.
function-help
(function-help)
`FUNCTION HELP` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(1)
Returns helpful text about the different subcommands.
Ref. https://redis.io/commands/function-help/ for more info.
function-kill
(function-kill)
function-list
(function-list)
(function-list & args)
`FUNCTION LIST` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N) where N is the number of functions
Returns information about all libraries.
Ref. https://redis.io/commands/function-list/ for more info.
function-load
(function-load arg1)
(function-load arg1 & args)
`FUNCTION LOAD` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(1) (considering compilation time is redundant)
Creates a library.
Ref. https://redis.io/commands/function-load/ for more info.
function-restore
(function-restore serialized-value)
(function-restore serialized-value & args)
`FUNCTION RESTORE` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N) where N is the number of functions on the payload
Restores all libraries from a payload.
Ref. https://redis.io/commands/function-restore/ for more info.
function-stats
(function-stats)
`FUNCTION STATS` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(1)
Returns information about a function during execution.
Ref. https://redis.io/commands/function-stats/ for more info.
geoadd
(geoadd key arg1 arg2 arg3)
(geoadd key arg1 arg2 arg3 & args)
`GEOADD` - Redis command function.
Available since: Redis 3.2.0
Complexity: O(log(N)) for each item added, where N is the number of elements in the sorted set.
Adds one or more members to a geospatial index. The key is created if it doesn't exist.
Ref. https://redis.io/commands/geoadd/ for more info.
geodist
(geodist key member1 member2)
(geodist key member1 member2 & args)
`GEODIST` - Redis command function.
Available since: Redis 3.2.0
Complexity: O(1)
Returns the distance between two members of a geospatial index.
Ref. https://redis.io/commands/geodist/ for more info.
geohash
(geohash key)
(geohash key & args)
`GEOHASH` - Redis command function.
Available since: Redis 3.2.0
Complexity: O(1) for each member requested.
Returns members from a geospatial index as geohash strings.
Ref. https://redis.io/commands/geohash/ for more info.
geopos
(geopos key)
(geopos key & args)
`GEOPOS` - Redis command function.
Available since: Redis 3.2.0
Complexity: O(1) for each member requested.
Returns the longitude and latitude of members from a geospatial index.
Ref. https://redis.io/commands/geopos/ for more info.
georadius
(georadius key longitude latitude radius arg1)
(georadius key longitude latitude radius arg1 & args)
`GEORADIUS` - Redis command function.
Available since: Redis 3.2.0
Complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.
Queries a geospatial index for members within a distance from a coordinate, optionally stores the result.
Ref. https://redis.io/commands/georadius/ for more info.
georadius_ro
(georadius_ro key longitude latitude radius arg1)
(georadius_ro key longitude latitude radius arg1 & args)
`GEORADIUS_RO` - Redis command function.
Available since: Redis 3.2.10
Complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.
Returns members from a geospatial index that are within a distance from a coordinate.
Ref. https://redis.io/commands/georadius_ro/ for more info.
georadiusbymember
(georadiusbymember key member radius arg1)
(georadiusbymember key member radius arg1 & args)
`GEORADIUSBYMEMBER` - Redis command function.
Available since: Redis 3.2.0
Complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.
Queries a geospatial index for members within a distance from a member, optionally stores the result.
Ref. https://redis.io/commands/georadiusbymember/ for more info.
georadiusbymember_ro
(georadiusbymember_ro key member radius arg1)
(georadiusbymember_ro key member radius arg1 & args)
`GEORADIUSBYMEMBER_RO` - Redis command function.
Available since: Redis 3.2.10
Complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.
Returns members from a geospatial index that are within a distance from a member.
Ref. https://redis.io/commands/georadiusbymember_ro/ for more info.
geosearch
(geosearch key arg1 arg2 arg3 arg4 arg5)
(geosearch key arg1 arg2 arg3 arg4 arg5 & args)
`GEOSEARCH` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(N+log(M)) where N is the number of elements in the grid-aligned bounding box area around the shape provided as the filter and M is the number of items inside the shape
Queries a geospatial index for members inside an area of a box or a circle.
Ref. https://redis.io/commands/geosearch/ for more info.
geosearchstore
(geosearchstore destination source arg1 arg2 arg3 arg4 arg5)
(geosearchstore destination source arg1 arg2 arg3 arg4 arg5 & args)
`GEOSEARCHSTORE` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(N+log(M)) where N is the number of elements in the grid-aligned bounding box area around the shape provided as the filter and M is the number of items inside the shape
Queries a geospatial index for members inside an area of a box or a circle, optionally stores the result.
Ref. https://redis.io/commands/geosearchstore/ for more info.
get
(get key)
`GET` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Returns the string value of a key.
Ref. https://redis.io/commands/get/ for more info.
getbit
(getbit key offset)
`GETBIT` - Redis command function.
Available since: Redis 2.2.0
Complexity: O(1)
Returns a bit value by offset.
Ref. https://redis.io/commands/getbit/ for more info.
getdel
(getdel key)
`GETDEL` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(1)
Returns the string value of a key after deleting the key.
Ref. https://redis.io/commands/getdel/ for more info.
getex
(getex key)
(getex key & args)
`GETEX` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(1)
Returns the string value of a key after setting its expiration time.
Ref. https://redis.io/commands/getex/ for more info.
getrange
(getrange key start end)
`GETRANGE` - Redis command function.
Available since: Redis 2.4.0
Complexity: O(N) where N is the length of the returned string. The complexity is ultimately determined by the returned length, but because creating a substring from an existing string is very cheap, it can be considered O(1) for small strings.
Returns a substring of the string stored at a key.
Ref. https://redis.io/commands/getrange/ for more info.
getset
(getset key value)
`GETSET` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Returns the previous string value of a key after setting it to a new value.
Ref. https://redis.io/commands/getset/ for more info.
hash-script
deprecated
DEPRECATED: Use `script-hash` instead.
hdel
(hdel key field)
(hdel key field & args)
`HDEL` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(N) where N is the number of fields to be removed.
Deletes one or more fields and their values from a hash. Deletes the hash if no fields remain.
Ref. https://redis.io/commands/hdel/ for more info.
hello
(hello)
(hello & args)
`HELLO` - Redis command function.
Available since: Redis 6.0.0
Complexity: O(1)
Handshakes with the Redis server.
Ref. https://redis.io/commands/hello/ for more info.
hexists
(hexists key field)
`HEXISTS` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(1)
Determines whether a field exists in a hash.
Ref. https://redis.io/commands/hexists/ for more info.
hget
(hget key field)
`HGET` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(1)
Returns the value of a field in a hash.
Ref. https://redis.io/commands/hget/ for more info.
hgetall
(hgetall key)
`HGETALL` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(N) where N is the size of the hash.
Returns all fields and values in a hash.
Ref. https://redis.io/commands/hgetall/ for more info.
hgetall*
deprecated
(hgetall* key & [keywordize?])
DEPRECATED: Use `parse-map` instead.
hincrby
(hincrby key field increment)
`HINCRBY` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(1)
Increments the integer value of a field in a hash by a number. Uses 0 as initial value if the field doesn't exist.
Ref. https://redis.io/commands/hincrby/ for more info.
hincrbyfloat
(hincrbyfloat key field increment)
`HINCRBYFLOAT` - Redis command function.
Available since: Redis 2.6.0
Complexity: O(1)
Increments the floating point value of a field by a number. Uses 0 as initial value if the field doesn't exist.
Ref. https://redis.io/commands/hincrbyfloat/ for more info.
hkeys
(hkeys key)
`HKEYS` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(N) where N is the size of the hash.
Returns all fields in a hash.
Ref. https://redis.io/commands/hkeys/ for more info.
hlen
(hlen key)
`HLEN` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(1)
Returns the number of fields in a hash.
Ref. https://redis.io/commands/hlen/ for more info.
hmget
(hmget key field)
(hmget key field & args)
`HMGET` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(N) where N is the number of fields being requested.
Returns the values of all fields in a hash.
Ref. https://redis.io/commands/hmget/ for more info.
hmget*
deprecated
(hmget* key field & more)
DEPRECATED: Use `parse-map` instead.
hmset
(hmset key arg1 arg2)
(hmset key arg1 arg2 & args)
`HMSET` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(N) where N is the number of fields being set.
Sets the values of multiple fields.
Ref. https://redis.io/commands/hmset/ for more info.
hmset*
(hmset* key m)
Like `hmset` but takes a map argument.
hrandfield
(hrandfield key)
(hrandfield key & args)
`HRANDFIELD` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(N) where N is the number of fields returned
Returns one or more random fields from a hash.
Ref. https://redis.io/commands/hrandfield/ for more info.
hscan
(hscan key cursor)
(hscan key cursor & args)
`HSCAN` - Redis command function.
Available since: Redis 2.8.0
Complexity: 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.
Iterates over fields and values of a hash.
Ref. https://redis.io/commands/hscan/ for more info.
hset
(hset key arg1 arg2)
(hset key arg1 arg2 & args)
`HSET` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(1) for each field/value pair added, so O(N) to add N field/value pairs when the command is called with multiple field/value pairs.
Creates or modifies the value of a field in a hash.
Ref. https://redis.io/commands/hset/ for more info.
hsetnx
(hsetnx key field value)
`HSETNX` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(1)
Sets the value of a field in a hash only when the field doesn't exist.
Ref. https://redis.io/commands/hsetnx/ for more info.
hstrlen
(hstrlen key field)
`HSTRLEN` - Redis command function.
Available since: Redis 3.2.0
Complexity: O(1)
Returns the length of the value of a field.
Ref. https://redis.io/commands/hstrlen/ for more info.
hvals
(hvals key)
`HVALS` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(N) where N is the size of the hash.
Returns all values in a hash.
Ref. https://redis.io/commands/hvals/ for more info.
incr
(incr key)
`INCR` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Increments the integer value of a key by one. Uses 0 as initial value if the key doesn't exist.
Ref. https://redis.io/commands/incr/ for more info.
incrby
(incrby key increment)
`INCRBY` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Increments the integer value of a key by a number. Uses 0 as initial value if the key doesn't exist.
Ref. https://redis.io/commands/incrby/ for more info.
incrbyfloat
(incrbyfloat key increment)
`INCRBYFLOAT` - Redis command function.
Available since: Redis 2.6.0
Complexity: O(1)
Increment the floating point value of a key by a number. Uses 0 as initial value if the key doesn't exist.
Ref. https://redis.io/commands/incrbyfloat/ for more info.
info
(info)
(info & args)
`INFO` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Returns information and statistics about the server.
Ref. https://redis.io/commands/info/ for more info.
info*
(info* & [clojureize?])
Like `info` but automatically coerces reply into a hash-map.
issue-83-workaround?
Workaround for Carmine issue #83.
Correct/intended behaviour:
- Byte arrays written with Carmine are read back as byte arrays.
Break introduced in v2.6.0 (April 1st 2014), issue #83:
- Byte arrays written with Carmine are accidentally serialized
with Nippy, and read back as serialized byte arrays.
Workaround introduced in v2.6.1 (May 1st 2014), issue #83:
- To help folks who had written binary data under v2.6.0,
Carmine started trying to auto-deserialize byte arrays that
start with the standard 4-byte Nippy header byte sequence.
Benefits:
b1. Folks affected by the earlier breakage can now read back
their byte arrays as expected.
Costs:
c1. A very minor performance hit when reading binary values
(because of check for a possible Nippy header).
c2. May encourage possible dependence on the workaround if
folks start pre-serializing Nippy data sent to Carmine,
expecting it to be auto-thawed on read.
c2 in particular means that it will probably never be safe to
disable this workaround by default.
However folks starting with Carmine after v2.6.1 and who have
never pre-serialized Nippy data written with Carmine may prefer
to disable the workaround.
If you're not sure what this is or if it's safe to change, you
should probably leave it at the default (true) value.
To change the default (true) value:
- Call `(alter-var-root #'taoensso.carmine/issue-83-workaround? (fn [_] false))`,
- or set one of the following to "false" or "FALSE":
- `taoensso.carmine.issue-83-workaround` JVM property
- `TAOENSSO_CARMINE_ISSUE_83_WORKAROUND` env var
Ref. https://github.com/ptaoussanis/carmine/issues/83 for more info.
key
(key & parts)
Joins parts to form an idiomatic compound Redis key name. Suggested style:
* "category:subcategory:id:field" basic form.
* Singular category names ("account" rather than "accounts").
* Plural _field_ names when appropriate ("account:friends").
* Dashes for long names ("email-address" rather than "emailAddress", etc.).
keys
(keys pattern)
`KEYS` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N) with N being the number of keys in the database, under the assumption that the key names in the database and the given pattern have limited length.
Returns all key names that match a pattern.
Ref. https://redis.io/commands/keys/ for more info.
kname
deprecated
(kname & parts)
DEPRECATED: Use `key` instead. `key` does not filter nil parts.
lastsave
(lastsave)
`LASTSAVE` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Returns the Unix timestamp of the last successful save to disk.
Ref. https://redis.io/commands/lastsave/ for more info.
latency
(latency arg1)
(latency arg1 & args)
`LATENCY` - Redis command function.
Available since: Redis 2.8.13
Complexity: Depends on subcommand.
A container for latency diagnostics commands.
Ref. https://redis.io/commands/latency/ for more info.
latency-doctor
(latency-doctor)
latency-graph
(latency-graph event)
latency-help
(latency-help)
`LATENCY HELP` - Redis command function.
Available since: Redis 2.8.13
Complexity: O(1)
Returns helpful text about the different subcommands.
Ref. https://redis.io/commands/latency-help/ for more info.
latency-histogram
(latency-histogram)
(latency-histogram & args)
`LATENCY HISTOGRAM` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N) where N is the number of commands with latency information being retrieved.
Returns the cumulative distribution of latencies of a subset or all commands.
Ref. https://redis.io/commands/latency-histogram/ for more info.
latency-history
(latency-history event)
latency-latest
(latency-latest)
latency-reset
(latency-reset)
(latency-reset & args)
lcs
(lcs key1 key2)
(lcs key1 key2 & args)
`LCS` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N*M) where N and M are the lengths of s1 and s2, respectively
Finds the longest common substring.
Ref. https://redis.io/commands/lcs/ for more info.
lindex
(lindex key index)
`LINDEX` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N) where N is the number of elements to traverse to get to the element at index. This makes asking for the first or the last element of the list O(1).
Returns an element from a list by its index.
Ref. https://redis.io/commands/lindex/ for more info.
linsert
(linsert key arg1 arg2 arg3)
`LINSERT` - Redis command function.
Available since: Redis 2.2.0
Complexity: O(N) where N is the number of elements to traverse before seeing the value pivot. This means that inserting somewhere on the left end on the list (head) can be considered O(1) and inserting somewhere on the right end (tail) is O(N).
Inserts an element before or after another element in a list.
Ref. https://redis.io/commands/linsert/ for more info.
llen
(llen key)
`LLEN` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Returns the length of a list.
Ref. https://redis.io/commands/llen/ for more info.
lmove
(lmove source destination arg1 arg2)
`LMOVE` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(1)
Returns an element after popping it from one list and pushing it to another. Deletes the list if the last element was moved.
Ref. https://redis.io/commands/lmove/ for more info.
lmpop
(lmpop numkeys key arg1)
(lmpop numkeys key arg1 & args)
`LMPOP` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N+M) where N is the number of provided keys and M is the number of elements returned.
Returns multiple elements from a list after removing them. Deletes the list if the last element was popped.
Ref. https://redis.io/commands/lmpop/ for more info.
lolwut
(lolwut)
(lolwut & args)
lpop
(lpop key)
(lpop key & args)
`LPOP` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N) where N is the number of elements returned
Returns the first elements in a list after removing it. Deletes the list if the last element was popped.
Ref. https://redis.io/commands/lpop/ for more info.
lpos
(lpos key element)
(lpos key element & args)
`LPOS` - Redis command function.
Available since: Redis 6.0.6
Complexity: O(N) where N is the number of elements in the list, for the average case. When searching for elements near the head or the tail of the list, or when the MAXLEN option is provided, the command may run in constant time.
Returns the index of matching elements in a list.
Ref. https://redis.io/commands/lpos/ for more info.
lpush
(lpush key element)
(lpush key element & args)
`LPUSH` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments.
Prepends one or more elements to a list. Creates the key if it doesn't exist.
Ref. https://redis.io/commands/lpush/ for more info.
lpushx
(lpushx key element)
(lpushx key element & args)
`LPUSHX` - Redis command function.
Available since: Redis 2.2.0
Complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments.
Prepends one or more elements to a list only when the list exists.
Ref. https://redis.io/commands/lpushx/ for more info.
lrange
(lrange key start stop)
`LRANGE` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(S+N) where S is the distance of start offset from HEAD for small lists, from nearest end (HEAD or TAIL) for large lists; and N is the number of elements in the specified range.
Returns a range of elements from a list.
Ref. https://redis.io/commands/lrange/ for more info.
lrem
(lrem key count element)
`LREM` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N+M) where N is the length of the list and M is the number of elements removed.
Removes elements from a list. Deletes the list if the last element was removed.
Ref. https://redis.io/commands/lrem/ for more info.
lset
(lset key index element)
`LSET` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N) where N is the length of the list. Setting either the first or the last element of the list is O(1).
Sets the value of an element in a list by its index.
Ref. https://redis.io/commands/lset/ for more info.
ltrim
(ltrim key start stop)
`LTRIM` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N) where N is the number of elements to be removed by the operation.
Removes elements from both ends a list. Deletes the list if all elements were trimmed.
Ref. https://redis.io/commands/ltrim/ for more info.
lua
(lua script keys args)
All singing, all dancing Lua script helper. Like `eval*` but allows script
vars to be provided as {<var> <value> ...} maps:
(lua "redis.call('set', _:my-key, _:my-arg)" {:my-key "foo} {:my-arg "bar"})
Keys are separate from other args as an implementation detail for clustering
purposes (keys need to all be on same shard).
lua-local
(lua-local script keys args)
Alpha - subject to change.
Like `lua`, but optimized for the single-server, single-client case: maintains
set of Lua scripts previously loaded by this client and will _not_ speculate
on script availability. CANNOT be used in environments where Redis servers may
go down and come back up again independently of application servers (clients).
lua-script
deprecated
(lua-script & args)
DEPRECATED: Use `lua` instead.
make-conn-pool
deprecated
(make-conn-pool & opts)
DEPRECATED: Use `wcar` instead.
make-conn-spec
deprecated
(make-conn-spec & opts)
DEPRECATED: Use `wcar` instead.
make-keyfn
deprecated
(make-keyfn & prefix-parts)
DEPRECATED: Use `kname` instead.
memory
(memory arg1)
(memory arg1 & args)
`MEMORY` - Redis command function.
Available since: Redis 4.0.0
Complexity: Depends on subcommand.
A container for memory diagnostics commands.
Ref. https://redis.io/commands/memory/ for more info.
memory-doctor
(memory-doctor)
memory-help
(memory-help)
`MEMORY HELP` - Redis command function.
Available since: Redis 4.0.0
Complexity: O(1)
Returns helpful text about the different subcommands.
Ref. https://redis.io/commands/memory-help/ for more info.
memory-malloc-stats
(memory-malloc-stats)
`MEMORY MALLOC-STATS` - Redis command function.
Available since: Redis 4.0.0
Complexity: Depends on how much memory is allocated, could be slow
Returns the allocator statistics.
Ref. https://redis.io/commands/memory-malloc-stats/ for more info.
memory-purge
(memory-purge)
`MEMORY PURGE` - Redis command function.
Available since: Redis 4.0.0
Complexity: Depends on how much memory is allocated, could be slow
Asks the allocator to release memory.
Ref. https://redis.io/commands/memory-purge/ for more info.
memory-stats
(memory-stats)
memory-usage
(memory-usage key)
(memory-usage key & args)
`MEMORY USAGE` - Redis command function.
Available since: Redis 4.0.0
Complexity: O(N) where N is the number of samples.
Estimates the memory usage of a key.
Ref. https://redis.io/commands/memory-usage/ for more info.
mget
(mget key)
(mget key & args)
`MGET` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N) where N is the number of keys to retrieve.
Atomically returns the string values of one or more keys.
Ref. https://redis.io/commands/mget/ for more info.
migrate
(migrate host port arg1 arg2 arg3)
(migrate host port arg1 arg2 arg3 & args)
`MIGRATE` - Redis command function.
Available since: Redis 2.6.0
Complexity: This command actually executes a DUMP+DEL in the source instance, and a RESTORE in the target instance. See the pages of these commands for time complexity. Also an O(N) data transfer between the two instances is performed.
Atomically transfers a key from one Redis instance to another.
Ref. https://redis.io/commands/migrate/ for more info.
module
(module arg1)
(module arg1 & args)
`MODULE` - Redis command function.
Available since: Redis 4.0.0
Complexity: Depends on subcommand.
A container for module commands.
Ref. https://redis.io/commands/module/ for more info.
module-help
(module-help)
`MODULE HELP` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(1)
Returns helpful text about the different subcommands.
Ref. https://redis.io/commands/module-help/ for more info.
module-list
(module-list)
`MODULE LIST` - Redis command function.
Available since: Redis 4.0.0
Complexity: O(N) where N is the number of loaded modules.
Returns all loaded modules.
Ref. https://redis.io/commands/module-list/ for more info.
module-load
(module-load path)
(module-load path & args)
module-loadex
(module-loadex path)
(module-loadex path & args)
module-unload
(module-unload name)
monitor
(monitor)
`MONITOR` - Redis command function.
Available since: Redis 1.0.0
Listens for all requests received by the server in real-time.
Ref. https://redis.io/commands/monitor/ for more info.
move
(move key db)
`MOVE` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Moves a key to another database.
Ref. https://redis.io/commands/move/ for more info.
mset
(mset arg1 arg2)
(mset arg1 arg2 & args)
`MSET` - Redis command function.
Available since: Redis 1.0.1
Complexity: O(N) where N is the number of keys to set.
Atomically creates or modifies the string values of one or more keys.
Ref. https://redis.io/commands/mset/ for more info.
msetnx
(msetnx arg1 arg2)
(msetnx arg1 arg2 & args)
`MSETNX` - Redis command function.
Available since: Redis 1.0.1
Complexity: O(N) where N is the number of keys to set.
Atomically modifies the string values of one or more keys only when all keys don't exist.
Ref. https://redis.io/commands/msetnx/ for more info.
object
(object arg1)
(object arg1 & args)
`OBJECT` - Redis command function.
Available since: Redis 2.2.3
Complexity: Depends on subcommand.
A container for object introspection commands.
Ref. https://redis.io/commands/object/ for more info.
object-encoding
(object-encoding key)
object-freq
(object-freq key)
`OBJECT FREQ` - Redis command function.
Available since: Redis 4.0.0
Complexity: O(1)
Returns the logarithmic access frequency counter of a Redis object.
Ref. https://redis.io/commands/object-freq/ for more info.
object-help
(object-help)
`OBJECT HELP` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(1)
Returns helpful text about the different subcommands.
Ref. https://redis.io/commands/object-help/ for more info.
object-idletime
(object-idletime key)
`OBJECT IDLETIME` - Redis command function.
Available since: Redis 2.2.3
Complexity: O(1)
Returns the time since the last access to a Redis object.
Ref. https://redis.io/commands/object-idletime/ for more info.
object-refcount
(object-refcount key)
parse
macro
(parse f & body)
Wraps body so that replies to any wrapped Redis commands will be parsed with
`(f reply)`. Replaces any current parser; removes parser when `f` is nil.
See also `parser-comp`.
parse-bool
macro
(parse-bool & body)
parse-double
macro
deprecated
(parse-double & body)
DEPRECATED: Use `parse-float` instead.
parse-float
macro
(parse-float & body)
parse-int
macro
(parse-int & body)
parse-keyword
macro
(parse-keyword & body)
parse-listener-msg
(parse-listener-msg listener-msg)
Parses given listener message of form:
- ["pong" ""]
- ["message" <channel> <payload>]
- ["pmessage" <pattern> <channel> <payload>], etc.
and returns {:kind _ :pattern _ :channel _ :payload _ :raw _}.
parse-long
macro
deprecated
(parse-long & body)
DEPRECATED: Use `parse-int` instead.
parse-map
macro
(parse-map form & [kf vf])
parse-nippy
macro
(parse-nippy thaw-opts & body)
parse-raw
macro
(parse-raw & body)
parse-suppress
macro
(parse-suppress & body)
parser-comp
(parser-comp f g)
Composes parsers when f or g are nnil, preserving metadata
persist
(persist key)
`PERSIST` - Redis command function.
Available since: Redis 2.2.0
Complexity: O(1)
Removes the expiration time of a key.
Ref. https://redis.io/commands/persist/ for more info.
pexpire
(pexpire key milliseconds)
(pexpire key milliseconds & args)
`PEXPIRE` - Redis command function.
Available since: Redis 2.6.0
Complexity: O(1)
Sets the expiration time of a key in milliseconds.
Ref. https://redis.io/commands/pexpire/ for more info.
pexpireat
(pexpireat key unix-time-milliseconds)
(pexpireat key unix-time-milliseconds & args)
`PEXPIREAT` - Redis command function.
Available since: Redis 2.6.0
Complexity: O(1)
Sets the expiration time of a key to a Unix milliseconds timestamp.
Ref. https://redis.io/commands/pexpireat/ for more info.
pexpiretime
(pexpiretime key)
`PEXPIRETIME` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(1)
Returns the expiration time of a key as a Unix milliseconds timestamp.
Ref. https://redis.io/commands/pexpiretime/ for more info.
pfadd
(pfadd key)
(pfadd key & args)
`PFADD` - Redis command function.
Available since: Redis 2.8.9
Complexity: O(1) to add every element.
Adds elements to a HyperLogLog key. Creates the key if it doesn't exist.
Ref. https://redis.io/commands/pfadd/ for more info.
pfcount
(pfcount key)
(pfcount key & args)
`PFCOUNT` - Redis command function.
Available since: Redis 2.8.9
Complexity: O(1) with a very small average constant time when called with a single key. O(N) with N being the number of keys, and much bigger constant times, when called with multiple keys.
Returns the approximated cardinality of the set(s) observed by the HyperLogLog key(s).
Ref. https://redis.io/commands/pfcount/ for more info.
pfdebug
(pfdebug subcommand key)
`PFDEBUG` - Redis command function.
Available since: Redis 2.8.9
Complexity: N/A
Internal commands for debugging HyperLogLog values.
Ref. https://redis.io/commands/pfdebug/ for more info.
pfmerge
(pfmerge destkey)
(pfmerge destkey & args)
`PFMERGE` - Redis command function.
Available since: Redis 2.8.9
Complexity: O(N) to merge N HyperLogLogs, but with high constant times.
Merges one or more HyperLogLog values into a single key.
Ref. https://redis.io/commands/pfmerge/ for more info.
pfselftest
(pfselftest)
`PFSELFTEST` - Redis command function.
Available since: Redis 2.8.9
Complexity: N/A
An internal command for testing HyperLogLog values.
Ref. https://redis.io/commands/pfselftest/ for more info.
ping
(ping)
(ping & args)
`PING` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Returns the server's liveliness response.
Ref. https://redis.io/commands/ping/ for more info.
preserve
deprecated
DEPRECATED: Use `freeze` instead.
psetex
(psetex key milliseconds value)
`PSETEX` - Redis command function.
Available since: Redis 2.6.0
Complexity: O(1)
Sets both string value and expiration time in milliseconds of a key. The key is created if it doesn't exist.
Ref. https://redis.io/commands/psetex/ for more info.
psubscribe
(psubscribe pattern)
(psubscribe pattern & args)
`PSUBSCRIBE` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(N) where N is the number of patterns to subscribe to.
Listens for messages published to channels that match one or more patterns.
Ref. https://redis.io/commands/psubscribe/ for more info.
psync
(psync replicationid offset)
(psync replicationid offset & args)
pttl
(pttl key)
`PTTL` - Redis command function.
Available since: Redis 2.6.0
Complexity: O(1)
Returns the expiration time in milliseconds of a key.
Ref. https://redis.io/commands/pttl/ for more info.
publish
(publish channel message)
`PUBLISH` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(N+M) where N is the number of clients subscribed to the receiving channel and M is the total number of subscribed patterns (by any client).
Posts a message to a channel.
Ref. https://redis.io/commands/publish/ for more info.
pubsub
(pubsub arg1)
(pubsub arg1 & args)
`PUBSUB` - Redis command function.
Available since: Redis 2.8.0
Complexity: Depends on subcommand.
A container for Pub/Sub commands.
Ref. https://redis.io/commands/pubsub/ for more info.
pubsub-channels
(pubsub-channels)
(pubsub-channels & args)
`PUBSUB CHANNELS` - Redis command function.
Available since: Redis 2.8.0
Complexity: O(N) where N is the number of active channels, and assuming constant time pattern matching (relatively short channels and patterns)
Returns the active channels.
Ref. https://redis.io/commands/pubsub-channels/ for more info.
pubsub-help
(pubsub-help)
`PUBSUB HELP` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(1)
Returns helpful text about the different subcommands.
Ref. https://redis.io/commands/pubsub-help/ for more info.
pubsub-numpat
(pubsub-numpat)
pubsub-numsub
(pubsub-numsub)
(pubsub-numsub & args)
`PUBSUB NUMSUB` - Redis command function.
Available since: Redis 2.8.0
Complexity: O(N) for the NUMSUB subcommand, where N is the number of requested channels
Returns a count of subscribers to channels.
Ref. https://redis.io/commands/pubsub-numsub/ for more info.
pubsub-shardchannels
(pubsub-shardchannels)
(pubsub-shardchannels & args)
`PUBSUB SHARDCHANNELS` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N) where N is the number of active shard channels, and assuming constant time pattern matching (relatively short shard channels).
Returns the active shard channels.
Ref. https://redis.io/commands/pubsub-shardchannels/ for more info.
pubsub-shardnumsub
(pubsub-shardnumsub)
(pubsub-shardnumsub & args)
`PUBSUB SHARDNUMSUB` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N) for the SHARDNUMSUB subcommand, where N is the number of requested shard channels
Returns the count of subscribers of shard channels.
Ref. https://redis.io/commands/pubsub-shardnumsub/ for more info.
punsubscribe
(punsubscribe)
(punsubscribe & args)
`PUNSUBSCRIBE` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(N) where N is the number of patterns to unsubscribe.
Stops listening to messages published to channels that match one or more patterns.
Ref. https://redis.io/commands/punsubscribe/ for more info.
randomkey
(randomkey)
`RANDOMKEY` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Returns a random key name from the database.
Ref. https://redis.io/commands/randomkey/ for more info.
raw
(raw x)
Forces byte[] argument to be sent to Redis as raw, unencoded bytes.
readonly
(readonly)
`READONLY` - Redis command function.
Available since: Redis 3.0.0
Complexity: O(1)
Enables read-only queries for a connection to a Redis Cluster replica node.
Ref. https://redis.io/commands/readonly/ for more info.
readwrite
(readwrite)
`READWRITE` - Redis command function.
Available since: Redis 3.0.0
Complexity: O(1)
Enables read-write queries for a connection to a Reids Cluster replica node.
Ref. https://redis.io/commands/readwrite/ for more info.
redis-call
(redis-call & requests)
Sends low-level requests to Redis. Useful for DSLs, certain kinds of command
composition, and for executing commands that haven't yet been added to the
official `commands.json` spec, Redis module commands, etc.
(redis-call ["set" "foo" "bar"] ["get" "foo"])
reduce-hscan
(reduce-hscan rf scan-fn)
(reduce-hscan rf acc-init scan-fn)
Experimental. Like `reduce-scan` but:
- `rf` is (fn [acc k v]), as in `reduce-kv`.
- `rf` will never be called with the same key twice
(i.e. automatically de-duplicates elements).
reduce-scan
(reduce-scan rf scan-fn)
(reduce-scan rf acc-init scan-fn)
For use with `scan`, `hscan`, `zscan`, etc. Takes:
- (fn rf [acc scan-result]) -> next accumulator
- (fn scan-fn [cursor]) -> next scan result
remember
deprecated
DEPRECATED: Use `return` instead.
rename
(rename key newkey)
`RENAME` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Renames a key and overwrites the destination.
Ref. https://redis.io/commands/rename/ for more info.
renamenx
(renamenx key newkey)
`RENAMENX` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Renames a key only when the target key name doesn't exist.
Ref. https://redis.io/commands/renamenx/ for more info.
replconf
(replconf)
(replconf & args)
`REPLCONF` - Redis command function.
Available since: Redis 3.0.0
Complexity: O(1)
An internal command for configuring the replication stream.
Ref. https://redis.io/commands/replconf/ for more info.
replicaof
(replicaof arg1 arg2)
`REPLICAOF` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(1)
Configures a server as replica of another, or promotes it to a master.
Ref. https://redis.io/commands/replicaof/ for more info.
restore
(restore key ttl serialized-value)
(restore key ttl serialized-value & args)
`RESTORE` - Redis command function.
Available since: Redis 2.6.0
Complexity: O(1) to create the new key and additional O(N*M) to reconstruct the serialized value, where N is the number of Redis objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1*M) where M is small, so simply O(1). However for sorted set values the complexity is O(N*M*log(N)) because inserting values into sorted sets is O(log(N)).
Creates a key from the serialized representation of a value.
Ref. https://redis.io/commands/restore/ for more info.
restore-asking
(restore-asking key ttl serialized-value)
(restore-asking key ttl serialized-value & args)
`RESTORE-ASKING` - Redis command function.
Available since: Redis 3.0.0
Complexity: O(1) to create the new key and additional O(N*M) to reconstruct the serialized value, where N is the number of Redis objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1*M) where M is small, so simply O(1). However for sorted set values the complexity is O(N*M*log(N)) because inserting values into sorted sets is O(log(N)).
An internal command for migrating keys in a cluster.
Ref. https://redis.io/commands/restore-asking/ for more info.
return
Takes values and returns them as part of next reply from Redis server.
Unlike `echo`, does not actually send any data to Redis.
role
(role)
`ROLE` - Redis command function.
Available since: Redis 2.8.12
Complexity: O(1)
Returns the replication role.
Ref. https://redis.io/commands/role/ for more info.
rpop
(rpop key)
(rpop key & args)
`RPOP` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N) where N is the number of elements returned
Returns and removes the last elements of a list. Deletes the list if the last element was popped.
Ref. https://redis.io/commands/rpop/ for more info.
rpoplpush
(rpoplpush source destination)
`RPOPLPUSH` - Redis command function.
Available since: Redis 1.2.0
Complexity: O(1)
Returns the last element of a list after removing and pushing it to another list. Deletes the list if the last element was popped.
Ref. https://redis.io/commands/rpoplpush/ for more info.
rpush
(rpush key element)
(rpush key element & args)
`RPUSH` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments.
Appends one or more elements to a list. Creates the key if it doesn't exist.
Ref. https://redis.io/commands/rpush/ for more info.
rpushx
(rpushx key element)
(rpushx key element & args)
`RPUSHX` - Redis command function.
Available since: Redis 2.2.0
Complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments.
Appends an element to a list only when the list exists.
Ref. https://redis.io/commands/rpushx/ for more info.
sadd
(sadd key member)
(sadd key member & args)
`SADD` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments.
Adds one or more members to a set. Creates the key if it doesn't exist.
Ref. https://redis.io/commands/sadd/ for more info.
save
(save)
`SAVE` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N) where N is the total number of keys in all databases
Synchronously saves the database(s) to disk.
Ref. https://redis.io/commands/save/ for more info.
scan
(scan cursor)
(scan cursor & args)
`SCAN` - Redis command function.
Available since: Redis 2.8.0
Complexity: 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.
Iterates over the key names in the database.
Ref. https://redis.io/commands/scan/ for more info.
scan-keys
(scan-keys conn-opts pattern)
Returns a set of Redis keys that match the given pattern.
Like the Redis `keys` command, but implemented using `scan` so safe to
use in production.
(scan-keys <conn-opts> "*") => Set of all keys
(scan-keys <conn-opts> "foo:*") => Set of all keys starting with "foo:"
scard
(scard key)
`SCARD` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Returns the number of members in a set.
Ref. https://redis.io/commands/scard/ for more info.
script
(script arg1)
(script arg1 & args)
`SCRIPT` - Redis command function.
Available since: Redis 2.6.0
Complexity: Depends on subcommand.
A container for Lua scripts management commands.
Ref. https://redis.io/commands/script/ for more info.
script-debug
(script-debug arg1)
script-exists
(script-exists sha1)
(script-exists sha1 & args)
`SCRIPT EXISTS` - Redis command function.
Available since: Redis 2.6.0
Complexity: O(N) with N being the number of scripts to check (so checking a single script is an O(1) operation).
Determines whether server-side Lua scripts exist in the script cache.
Ref. https://redis.io/commands/script-exists/ for more info.
script-flush
(script-flush)
(script-flush & args)
`SCRIPT FLUSH` - Redis command function.
Available since: Redis 2.6.0
Complexity: O(N) with N being the number of scripts in cache
Removes all server-side Lua scripts from the script cache.
Ref. https://redis.io/commands/script-flush/ for more info.
script-help
(script-help)
`SCRIPT HELP` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(1)
Returns helpful text about the different subcommands.
Ref. https://redis.io/commands/script-help/ for more info.
script-kill
(script-kill)
`SCRIPT KILL` - Redis command function.
Available since: Redis 2.6.0
Complexity: O(1)
Terminates a server-side Lua script during execution.
Ref. https://redis.io/commands/script-kill/ for more info.
script-load
(script-load script)
`SCRIPT LOAD` - Redis command function.
Available since: Redis 2.6.0
Complexity: O(N) with N being the length in bytes of the script body.
Loads a server-side Lua script to the script cache.
Ref. https://redis.io/commands/script-load/ for more info.
sdiff
(sdiff key)
(sdiff key & args)
`SDIFF` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N) where N is the total number of elements in all given sets.
Returns the difference of multiple sets.
Ref. https://redis.io/commands/sdiff/ for more info.
sdiffstore
(sdiffstore destination key)
(sdiffstore destination key & args)
`SDIFFSTORE` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N) where N is the total number of elements in all given sets.
Stores the difference of multiple sets in a key.
Ref. https://redis.io/commands/sdiffstore/ for more info.
select
(select index)
`SELECT` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Changes the selected database.
Ref. https://redis.io/commands/select/ for more info.
serialize
deprecated
DEPRECATED: Use `freeze` instead.
set
(set key value)
(set key value & args)
`SET` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Sets the string value of a key, ignoring its type. The key is created if it doesn't exist.
Ref. https://redis.io/commands/set/ for more info.
set-min-log-level!
(set-min-log-level! level)
Sets Timbre's minimum log level for internal Carmine namespaces.
Possible levels: #{:trace :debug :info :warn :error :fatal :report}.
Default level: `:warn`.
setbit
(setbit key offset value)
`SETBIT` - Redis command function.
Available since: Redis 2.2.0
Complexity: O(1)
Sets or clears the bit at offset of the string value. Creates the key if it doesn't exist.
Ref. https://redis.io/commands/setbit/ for more info.
setex
(setex key seconds value)
`SETEX` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(1)
Sets the string value and expiration time of a key. Creates the key if it doesn't exist.
Ref. https://redis.io/commands/setex/ for more info.
setnx
(setnx key value)
`SETNX` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Set the string value of a key only when the key doesn't exist.
Ref. https://redis.io/commands/setnx/ for more info.
setrange
(setrange key offset value)
`SETRANGE` - Redis command function.
Available since: Redis 2.2.0
Complexity: O(1), not counting the time taken to copy the new string in place. Usually, this string is very small so the amortized complexity is O(1). Otherwise, complexity is O(M) with M being the length of the value argument.
Overwrites a part of a string value with another by an offset. Creates the key if it doesn't exist.
Ref. https://redis.io/commands/setrange/ for more info.
shutdown
(shutdown)
(shutdown & args)
`SHUTDOWN` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N) when saving, where N is the total number of keys in all databases when saving data, otherwise O(1)
Synchronously saves the database(s) to disk and shuts down the Redis server.
Ref. https://redis.io/commands/shutdown/ for more info.
sinter
(sinter key)
(sinter key & args)
`SINTER` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets.
Returns the intersect of multiple sets.
Ref. https://redis.io/commands/sinter/ for more info.
sintercard
(sintercard numkeys key)
(sintercard numkeys key & args)
`SINTERCARD` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets.
Returns the number of members of the intersect of multiple sets.
Ref. https://redis.io/commands/sintercard/ for more info.
sinterstore
(sinterstore destination key)
(sinterstore destination key & args)
`SINTERSTORE` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets.
Stores the intersect of multiple sets in a key.
Ref. https://redis.io/commands/sinterstore/ for more info.
sismember
(sismember key member)
`SISMEMBER` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Determines whether a member belongs to a set.
Ref. https://redis.io/commands/sismember/ for more info.
skip-replies
macro
deprecated
DEPRECATED: Use `with-replies` instead.
slaveof
(slaveof arg1 arg2)
`SLAVEOF` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Sets a Redis server as a replica of another, or promotes it to being a master.
Ref. https://redis.io/commands/slaveof/ for more info.
slowlog
(slowlog arg1)
(slowlog arg1 & args)
`SLOWLOG` - Redis command function.
Available since: Redis 2.2.12
Complexity: Depends on subcommand.
A container for slow log commands.
Ref. https://redis.io/commands/slowlog/ for more info.
slowlog-get
(slowlog-get)
(slowlog-get & args)
`SLOWLOG GET` - Redis command function.
Available since: Redis 2.2.12
Complexity: O(N) where N is the number of entries returned
Returns the slow log's entries.
Ref. https://redis.io/commands/slowlog-get/ for more info.
slowlog-help
(slowlog-help)
`SLOWLOG HELP` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(1)
Show helpful text about the different subcommands
Ref. https://redis.io/commands/slowlog-help/ for more info.
slowlog-len
(slowlog-len)
`SLOWLOG LEN` - Redis command function.
Available since: Redis 2.2.12
Complexity: O(1)
Returns the number of entries in the slow log.
Ref. https://redis.io/commands/slowlog-len/ for more info.
slowlog-reset
(slowlog-reset)
`SLOWLOG RESET` - Redis command function.
Available since: Redis 2.2.12
Complexity: O(N) where N is the number of entries in the slowlog
Clears all entries from the slow log.
Ref. https://redis.io/commands/slowlog-reset/ for more info.
smembers
(smembers key)
`SMEMBERS` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N) where N is the set cardinality.
Returns all members of a set.
Ref. https://redis.io/commands/smembers/ for more info.
smismember
(smismember key member)
(smismember key member & args)
`SMISMEMBER` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(N) where N is the number of elements being checked for membership
Determines whether multiple members belong to a set.
Ref. https://redis.io/commands/smismember/ for more info.
smove
(smove source destination member)
`SMOVE` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Moves a member from one set to another.
Ref. https://redis.io/commands/smove/ for more info.
sort
(sort key)
(sort key & args)
`SORT` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N+M*log(M)) where N is the number of elements in the list or set to sort, and M the number of returned elements. When the elements are not sorted, complexity is O(N).
Sorts the elements in a list, a set, or a sorted set, optionally storing the result.
Ref. https://redis.io/commands/sort/ for more info.
sort*
(sort* key & sort-args)
Like `sort` but supports idiomatic Clojure arguments: :by pattern,
:limit offset count, :get pattern, :mget patterns, :store destination,
:alpha, :asc, :desc.
sort_ro
(sort_ro key)
(sort_ro key & args)
`SORT_RO` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N+M*log(M)) where N is the number of elements in the list or set to sort, and M the number of returned elements. When the elements are not sorted, complexity is O(N).
Returns the sorted elements of a list, a set, or a sorted set.
Ref. https://redis.io/commands/sort_ro/ for more info.
spop
(spop key)
(spop key & args)
`SPOP` - Redis command function.
Available since: Redis 1.0.0
Complexity: Without the count argument O(1), otherwise O(N) where N is the value of the passed count.
Returns one or more random members from a set after removing them. Deletes the set if the last member was popped.
Ref. https://redis.io/commands/spop/ for more info.
spublish
(spublish shardchannel message)
`SPUBLISH` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N) where N is the number of clients subscribed to the receiving shard channel.
Post a message to a shard channel
Ref. https://redis.io/commands/spublish/ for more info.
srandmember
(srandmember key)
(srandmember key & args)
`SRANDMEMBER` - Redis command function.
Available since: Redis 1.0.0
Complexity: Without the count argument O(1), otherwise O(N) where N is the absolute value of the passed count.
Get one or multiple random members from a set
Ref. https://redis.io/commands/srandmember/ for more info.
srem
(srem key member)
(srem key member & args)
`SREM` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N) where N is the number of members to be removed.
Removes one or more members from a set. Deletes the set if the last member was removed.
Ref. https://redis.io/commands/srem/ for more info.
sscan
(sscan key cursor)
(sscan key cursor & args)
`SSCAN` - Redis command function.
Available since: Redis 2.8.0
Complexity: 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.
Iterates over members of a set.
Ref. https://redis.io/commands/sscan/ for more info.
ssubscribe
(ssubscribe shardchannel)
(ssubscribe shardchannel & args)
`SSUBSCRIBE` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N) where N is the number of shard channels to subscribe to.
Listens for messages published to shard channels.
Ref. https://redis.io/commands/ssubscribe/ for more info.
strlen
(strlen key)
`STRLEN` - Redis command function.
Available since: Redis 2.2.0
Complexity: O(1)
Returns the length of a string value.
Ref. https://redis.io/commands/strlen/ for more info.
subscribe
(subscribe channel)
(subscribe channel & args)
`SUBSCRIBE` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(N) where N is the number of channels to subscribe to.
Listens for messages published to channels.
Ref. https://redis.io/commands/subscribe/ for more info.
substr
(substr key start end)
`SUBSTR` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N) where N is the length of the returned string. The complexity is ultimately determined by the returned length, but because creating a substring from an existing string is very cheap, it can be considered O(1) for small strings.
Returns a substring from a string value.
Ref. https://redis.io/commands/substr/ for more info.
sunion
(sunion key)
(sunion key & args)
`SUNION` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N) where N is the total number of elements in all given sets.
Returns the union of multiple sets.
Ref. https://redis.io/commands/sunion/ for more info.
sunionstore
(sunionstore destination key)
(sunionstore destination key & args)
`SUNIONSTORE` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(N) where N is the total number of elements in all given sets.
Stores the union of multiple sets in a key.
Ref. https://redis.io/commands/sunionstore/ for more info.
sunsubscribe
(sunsubscribe)
(sunsubscribe & args)
`SUNSUBSCRIBE` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N) where N is the number of shard channels to unsubscribe.
Stops listening to messages posted to shard channels.
Ref. https://redis.io/commands/sunsubscribe/ for more info.
swapdb
(swapdb index1 index2)
`SWAPDB` - Redis command function.
Available since: Redis 4.0.0
Complexity: O(N) where N is the count of clients watching or blocking on keys from both databases.
Swaps two Redis databases.
Ref. https://redis.io/commands/swapdb/ for more info.
thaw-if-possible-nippy-bytes
(thaw-if-possible-nippy-bytes x)
(thaw-if-possible-nippy-bytes x opts)
If given agrgument is a byte-array starting with apparent NPY header,
calls `nippy/thaw` against argument, otherwise passes it through.
This util can be useful if you're manually disabling
`issue-83-workaround` but still have some cases where you're possibly
trying to read data affected by that issue.
NB does not trap thaw exceptions.
See `issue-83-workaround` for more info.
time
(time)
`TIME` - Redis command function.
Available since: Redis 2.6.0
Complexity: O(1)
Returns the server time.
Ref. https://redis.io/commands/time/ for more info.
touch
(touch key)
(touch key & args)
`TOUCH` - Redis command function.
Available since: Redis 3.2.1
Complexity: O(N) where N is the number of keys that will be touched.
Returns the number of existing keys out of those specified after updating the time they were last accessed.
Ref. https://redis.io/commands/touch/ for more info.
ttl
(ttl key)
`TTL` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Returns the expiration time in seconds of a key.
Ref. https://redis.io/commands/ttl/ for more info.
type
(type key)
`TYPE` - Redis command function.
Available since: Redis 1.0.0
Complexity: O(1)
Determines the type of value stored at a key.
Ref. https://redis.io/commands/type/ for more info.
unlink
(unlink key)
(unlink key & args)
`UNLINK` - Redis command function.
Available since: Redis 4.0.0
Complexity: O(1) for each key removed regardless of its size. Then the command does O(N) work in a different thread in order to reclaim memory, where N is the number of allocations the deleted objects where composed of.
Asynchronously deletes one or more keys.
Ref. https://redis.io/commands/unlink/ for more info.
unsubscribe
(unsubscribe)
(unsubscribe & args)
`UNSUBSCRIBE` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(N) where N is the number of channels to unsubscribe.
Stops listening to messages posted to channels.
Ref. https://redis.io/commands/unsubscribe/ for more info.
unwatch
(unwatch)
`UNWATCH` - Redis command function.
Available since: Redis 2.2.0
Complexity: O(1)
Forgets about watched keys of a transaction.
Ref. https://redis.io/commands/unwatch/ for more info.
wait
(wait numreplicas timeout)
`WAIT` - Redis command function.
Available since: Redis 3.0.0
Complexity: O(1)
Blocks until the asynchronous replication of all preceding write commands sent by the connection is completed.
Ref. https://redis.io/commands/wait/ for more info.
waitaof
(waitaof numlocal numreplicas timeout)
`WAITAOF` - Redis command function.
Available since: Redis 7.2.0
Complexity: O(1)
Blocks until all of the preceding write commands sent by the connection are written to the append-only file of the master and/or replicas.
Ref. https://redis.io/commands/waitaof/ for more info.
watch
(watch key)
(watch key & args)
`WATCH` - Redis command function.
Available since: Redis 2.2.0
Complexity: O(1) for every key.
Monitors changes to keys to determine the execution of a transaction.
Ref. https://redis.io/commands/watch/ for more info.
wcar
macro
(wcar conn-opts :as-pipeline & body)
(wcar conn-opts & body)
Main entry-point for the Carmine API.
Does the following:
1. Establishes a connection to specified Redis server.
2. Sends any Redis commands in body to the server as a pipeline.
3. Reads and returns the server's reply.
4. Destroys the connection, or returns it to connection pool.
`conn-opts` arg is a map of `:spec`, `:pool` keys.
`spec` describes the connection details, e.g.:
- {:host "127.0.0.1" :port 6379} ; Default
- {:uri "redis://username:password@host.foo.com:9475/3" ; /3 for db 3
- {:host "127.0.0.1"
:port 6379
:ssl-fn :default ; [1]
:username "alice"
:password "secret"
:timeout-ms 6000
:db 3}
`pool` may be:
- The `:none` keyword (=> don't pool connections)
- A custom pool you've created manually with `connection-pool`
- A map of pool-opts as provided to `connection-pool` (a pool
will be automatically created, then reused on subsequent
calls with the same opts)
If no `pool` value is specified, a default pool will be created
then reused.
Note that because of thread-binding, you'll probably want to avoid lazy
Redis commands in `wcar`'s body. Compare:
`(wcar {} (for [k [:k1 :k2]] (car/set k :val))` ; Lazy, 0 commands run
`(wcar {} (doseq [k [:k1 :k2]] (car/set k :val))` ; Eager, 2 commands run
See also `connection-pool`, `with-replies`.
[1] Optional `ssl-fn` conn opt takes and returns a `java.net.Socket`:
(fn [{:keys [^Socket socket host port]}]) -> ^Socket
`:default` => use `taoensso.carmine.connections/default-ssl-fn`.
with-conn
macro
deprecated
(with-conn connection-pool connection-spec & body)
DEPRECATED: Use `wcar` instead.
with-new-listener
macro
(with-new-listener conn-spec handler-fn init-state & body)
Creates a persistent[1] connection to Redis server and a future to listen for
server messages on that connection.
(fn handler [msg current-state]) will be called on each incoming message [2].
Evaluates body within the context of the connection and returns a
general-purpose Listener containing:
1. The connection for use with `with-open-listener`, `close-listener`.
2. An atom containing the handler fn.
3. An atom containing optional listener state.
Useful for Pub/Sub, monitoring, etc.
Errors will be published to "carmine:listener:error" channel with Clojure
payload {:keys [error throwable listener]},
:error e/o #{:conn-closed :conn-broken :handler-ex}.
[1] You probably do *NOT* want a :timeout for your `conn-spec` here.
`conn-spec` can include `:ping-ms`, which'll test conn every given msecs.
[2] See also `parse-listener-msg`.
with-new-pubsub-listener
macro
(with-new-pubsub-listener conn-spec handler & subscription-commands)
Like `with-new-listener` but `handler` should be a map of form:
{<channel-or-pattern-string> (fn handler [msg])}.
Example:
(with-new-pubsub-listener
{} ; Connection spec, as per `wcar` docstring [1]
{"channel1" (fn f1 [msg] (println "f1:" msg))
"channel*" (fn f2 [msg] (println "f2:" msg))
"ch*" (fn f3 [msg] (println "f3:" msg))}
(subscribe "channel1") ; Subscribe to 1x channel
(psubscribe "channel*" "ch*") ; Subscribe to 2x channel patterns
)
Exactly 1 handler fn will trigger per published message exactly matching
each active subscription:
- `channel1` handler (`f1`) will trigger for messages to `channel1`.
- `channel*` handler (`f2`) will trigger for messages to `channel1`, `channel2`, etc.
- `ch*` handler (`f3`) will trigger for messages to `channel1`, `channel2`, etc.
So publishing to "channel1" in this example will trigger all 3x handlers.
See `with-new-listener` for more info.
with-open-listener
macro
(with-open-listener listener & body)
Evaluates body within the context of given listener's pre-existing persistent
connection.
with-parser
macro
deprecated
DEPRECATED: Use `parse` instead.
with-replies
macro
(with-replies :as-pipeline & body)
(with-replies & body)
Alpha - subject to change.
Evaluates body, immediately returning the server's response to any
contained Redis commands (i.e. before enclosing context ends).
As an implementation detail, stashes and then `return`s any replies already
queued with Redis server: i.e. should be compatible with pipelining.
Note on parsers: if you're writing a Redis command (e.g. a fn that is
intended to execute w/in an implicit connection context) and you're using
`with-replies` as an implementation detail (i.e. you're interpreting
replies internally), you probably want `(parse nil (with-replies ...))` to
keep external parsers from leaking into your internal logic.
with-reply
macro
deprecated
DEPRECATED: Use `with-replies` instead.
with-thaw-opts
macro
(with-thaw-opts opts & body)
xack
(xack key group id)
(xack key group id & args)
`XACK` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(1) for each message ID processed.
Returns the number of messages that were successfully acknowledged by the consumer group member of a stream.
Ref. https://redis.io/commands/xack/ for more info.
xadd
(xadd key arg1 arg2 arg3)
(xadd key arg1 arg2 arg3 & args)
`XADD` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(1) when adding a new entry, O(N) when trimming where N being the number of entries evicted.
Appends a new message to a stream. Creates the key if it doesn't exist.
Ref. https://redis.io/commands/xadd/ for more info.
xautoclaim
(xautoclaim key group consumer min-idle-time start)
(xautoclaim key group consumer min-idle-time start & args)
`XAUTOCLAIM` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(1) if COUNT is small.
Changes, or acquires, ownership of messages in a consumer group, as if the messages were delivered to as consumer group member.
Ref. https://redis.io/commands/xautoclaim/ for more info.
xclaim
(xclaim key group consumer min-idle-time id)
(xclaim key group consumer min-idle-time id & args)
`XCLAIM` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(log N) with N being the number of messages in the PEL of the consumer group.
Changes, or acquires, ownership of a message in a consumer group, as if the message was delivered a consumer group member.
Ref. https://redis.io/commands/xclaim/ for more info.
xdel
(xdel key id)
(xdel key id & args)
`XDEL` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(1) for each single item to delete in the stream, regardless of the stream size.
Returns the number of messages after removing them from a stream.
Ref. https://redis.io/commands/xdel/ for more info.
xgroup
(xgroup arg1)
(xgroup arg1 & args)
`XGROUP` - Redis command function.
Available since: Redis 5.0.0
Complexity: Depends on subcommand.
A container for consumer groups commands.
Ref. https://redis.io/commands/xgroup/ for more info.
xgroup-create
(xgroup-create key group arg1)
(xgroup-create key group arg1 & args)
xgroup-createconsumer
(xgroup-createconsumer key group consumer)
xgroup-delconsumer
(xgroup-delconsumer key group consumer)
xgroup-destroy
(xgroup-destroy key group)
`XGROUP DESTROY` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(N) where N is the number of entries in the group's pending entries list (PEL).
Destroys a consumer group.
Ref. https://redis.io/commands/xgroup-destroy/ for more info.
xgroup-help
(xgroup-help)
`XGROUP HELP` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(1)
Returns helpful text about the different subcommands.
Ref. https://redis.io/commands/xgroup-help/ for more info.
xgroup-setid
(xgroup-setid key group arg1)
(xgroup-setid key group arg1 & args)
xinfo
(xinfo arg1)
(xinfo arg1 & args)
`XINFO` - Redis command function.
Available since: Redis 5.0.0
Complexity: Depends on subcommand.
A container for stream introspection commands.
Ref. https://redis.io/commands/xinfo/ for more info.
xinfo-consumers
(xinfo-consumers key group)
xinfo-groups
(xinfo-groups key)
`XINFO GROUPS` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(1)
Returns a list of the consumer groups of a stream.
Ref. https://redis.io/commands/xinfo-groups/ for more info.
xinfo-help
(xinfo-help)
`XINFO HELP` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(1)
Returns helpful text about the different subcommands.
Ref. https://redis.io/commands/xinfo-help/ for more info.
xinfo-stream
(xinfo-stream key)
(xinfo-stream key & args)
xlen
(xlen key)
`XLEN` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(1)
Return the number of messages in a stream.
Ref. https://redis.io/commands/xlen/ for more info.
xpending
(xpending key group)
(xpending key group & args)
`XPENDING` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(N) with N being the number of elements returned, so asking for a small fixed number of entries per call is O(1). O(M), where M is the total number of entries scanned when used with the IDLE filter. When the command returns just the summary and the list of consumers is small, it runs in O(1) time; otherwise, an additional O(N) time for iterating every consumer.
Returns the information and entries from a stream consumer group's pending entries list.
Ref. https://redis.io/commands/xpending/ for more info.
xrange
(xrange key start end)
(xrange key start end & args)
`XRANGE` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(N) with N being the number of elements being returned. If N is constant (e.g. always asking for the first 10 elements with COUNT), you can consider it O(1).
Returns the messages from a stream within a range of IDs.
Ref. https://redis.io/commands/xrange/ for more info.
xread
(xread arg1 arg2 arg3)
(xread arg1 arg2 arg3 & args)
`XREAD` - Redis command function.
Available since: Redis 5.0.0
Returns messages from multiple streams with IDs greater than the ones requested. Blocks until a message is available otherwise.
Ref. https://redis.io/commands/xread/ for more info.
xreadgroup
(xreadgroup arg1 arg2 arg3 arg4 arg5 arg6)
(xreadgroup arg1 arg2 arg3 arg4 arg5 arg6 & args)
`XREADGROUP` - Redis command function.
Available since: Redis 5.0.0
Complexity: For each stream mentioned: O(M) with M being the number of elements returned. If M is constant (e.g. always asking for the first 10 elements with COUNT), you can consider it O(1). On the other side when XREADGROUP blocks, XADD will pay the O(N) time in order to serve the N clients blocked on the stream getting new data.
Returns new or historical messages from a stream for a consumer in a group. Blocks until a message is available otherwise.
Ref. https://redis.io/commands/xreadgroup/ for more info.
xrevrange
(xrevrange key end start)
(xrevrange key end start & args)
`XREVRANGE` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(N) with N being the number of elements returned. If N is constant (e.g. always asking for the first 10 elements with COUNT), you can consider it O(1).
Returns the messages from a stream within a range of IDs in reverse order.
Ref. https://redis.io/commands/xrevrange/ for more info.
xsetid
(xsetid key last-id)
(xsetid key last-id & args)
`XSETID` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(1)
An internal command for replicating stream values.
Ref. https://redis.io/commands/xsetid/ for more info.
xtrim
(xtrim key arg1 arg2)
(xtrim key arg1 arg2 & args)
`XTRIM` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(N), with N being the number of evicted entries. Constant times are very small however, since entries are organized in macro nodes containing multiple entries that can be released with a single deallocation.
Deletes messages from the beginning of a stream.
Ref. https://redis.io/commands/xtrim/ for more info.
zadd
(zadd key arg1 arg2)
(zadd key arg1 arg2 & args)
`ZADD` - Redis command function.
Available since: Redis 1.2.0
Complexity: O(log(N)) for each item added, where N is the number of elements in the sorted set.
Adds one or more members to a sorted set, or updates their scores. Creates the key if it doesn't exist.
Ref. https://redis.io/commands/zadd/ for more info.
zcard
(zcard key)
`ZCARD` - Redis command function.
Available since: Redis 1.2.0
Complexity: O(1)
Returns the number of members in a sorted set.
Ref. https://redis.io/commands/zcard/ for more info.
zcount
(zcount key min max)
`ZCOUNT` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(log(N)) with N being the number of elements in the sorted set.
Returns the count of members in a sorted set that have scores within a range.
Ref. https://redis.io/commands/zcount/ for more info.
zdiff
(zdiff numkeys key)
(zdiff numkeys key & args)
`ZDIFF` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(L + (N-K)log(N)) worst case where L is the total number of elements in all the sets, N is the size of the first set, and K is the size of the result set.
Returns the difference between multiple sorted sets.
Ref. https://redis.io/commands/zdiff/ for more info.
zdiffstore
(zdiffstore destination numkeys key)
(zdiffstore destination numkeys key & args)
`ZDIFFSTORE` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(L + (N-K)log(N)) worst case where L is the total number of elements in all the sets, N is the size of the first set, and K is the size of the result set.
Stores the difference of multiple sorted sets in a key.
Ref. https://redis.io/commands/zdiffstore/ for more info.
zincrby
(zincrby key increment member)
`ZINCRBY` - Redis command function.
Available since: Redis 1.2.0
Complexity: O(log(N)) where N is the number of elements in the sorted set.
Increments the score of a member in a sorted set.
Ref. https://redis.io/commands/zincrby/ for more info.
zinter
(zinter numkeys key)
(zinter numkeys key & args)
`ZINTER` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(N*K)+O(M*log(M)) worst case with N being the smallest input sorted set, K being the number of input sorted sets and M being the number of elements in the resulting sorted set.
Returns the intersect of multiple sorted sets.
Ref. https://redis.io/commands/zinter/ for more info.
zintercard
(zintercard numkeys key)
(zintercard numkeys key & args)
`ZINTERCARD` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(N*K) worst case with N being the smallest input sorted set, K being the number of input sorted sets.
Returns the number of members of the intersect of multiple sorted sets.
Ref. https://redis.io/commands/zintercard/ for more info.
zinterstore
(zinterstore destination numkeys key)
(zinterstore destination numkeys key & args)
`ZINTERSTORE` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(N*K)+O(M*log(M)) worst case with N being the smallest input sorted set, K being the number of input sorted sets and M being the number of elements in the resulting sorted set.
Stores the intersect of multiple sorted sets in a key.
Ref. https://redis.io/commands/zinterstore/ for more info.
zinterstore*
(zinterstore* dest-key source-keys & opts)
Like `zinterstore` but automatically counts keys.
zlexcount
(zlexcount key min max)
`ZLEXCOUNT` - Redis command function.
Available since: Redis 2.8.9
Complexity: O(log(N)) with N being the number of elements in the sorted set.
Returns the number of members in a sorted set within a lexicographical range.
Ref. https://redis.io/commands/zlexcount/ for more info.
zmpop
(zmpop numkeys key arg1)
(zmpop numkeys key arg1 & args)
`ZMPOP` - Redis command function.
Available since: Redis 7.0.0
Complexity: O(K) + O(M*log(N)) where K is the number of provided keys, N being the number of elements in the sorted set, and M being the number of elements popped.
Returns the highest- or lowest-scoring members from one or more sorted sets after removing them. Deletes the sorted set if the last member was popped.
Ref. https://redis.io/commands/zmpop/ for more info.
zmscore
(zmscore key member)
(zmscore key member & args)
`ZMSCORE` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(N) where N is the number of members being requested.
Returns the score of one or more members in a sorted set.
Ref. https://redis.io/commands/zmscore/ for more info.
zpopmax
(zpopmax key)
(zpopmax key & args)
`ZPOPMAX` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(log(N)*M) with N being the number of elements in the sorted set, and M being the number of elements popped.
Returns the highest-scoring members from a sorted set after removing them. Deletes the sorted set if the last member was popped.
Ref. https://redis.io/commands/zpopmax/ for more info.
zpopmin
(zpopmin key)
(zpopmin key & args)
`ZPOPMIN` - Redis command function.
Available since: Redis 5.0.0
Complexity: O(log(N)*M) with N being the number of elements in the sorted set, and M being the number of elements popped.
Returns the lowest-scoring members from a sorted set after removing them. Deletes the sorted set if the last member was popped.
Ref. https://redis.io/commands/zpopmin/ for more info.
zrandmember
(zrandmember key)
(zrandmember key & args)
`ZRANDMEMBER` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(N) where N is the number of members returned
Returns one or more random members from a sorted set.
Ref. https://redis.io/commands/zrandmember/ for more info.
zrange
(zrange key start stop)
(zrange key start stop & args)
`ZRANGE` - Redis command function.
Available since: Redis 1.2.0
Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements returned.
Returns members in a sorted set within a range of indexes.
Ref. https://redis.io/commands/zrange/ for more info.
zrangebylex
(zrangebylex key min max)
(zrangebylex key min max & args)
`ZRANGEBYLEX` - Redis command function.
Available since: Redis 2.8.9
Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned. If M is constant (e.g. always asking for the first 10 elements with LIMIT), you can consider it O(log(N)).
Returns members in a sorted set within a lexicographical range.
Ref. https://redis.io/commands/zrangebylex/ for more info.
zrangebyscore
(zrangebyscore key min max)
(zrangebyscore key min max & args)
`ZRANGEBYSCORE` - Redis command function.
Available since: Redis 1.0.5
Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned. If M is constant (e.g. always asking for the first 10 elements with LIMIT), you can consider it O(log(N)).
Returns members in a sorted set within a range of scores.
Ref. https://redis.io/commands/zrangebyscore/ for more info.
zrangestore
(zrangestore dst src min max)
(zrangestore dst src min max & args)
`ZRANGESTORE` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements stored into the destination key.
Stores a range of members from sorted set in a key.
Ref. https://redis.io/commands/zrangestore/ for more info.
zrank
(zrank key member)
(zrank key member & args)
`ZRANK` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(log(N))
Returns the index of a member in a sorted set ordered by ascending scores.
Ref. https://redis.io/commands/zrank/ for more info.
zrem
(zrem key member)
(zrem key member & args)
`ZREM` - Redis command function.
Available since: Redis 1.2.0
Complexity: O(M*log(N)) with N being the number of elements in the sorted set and M the number of elements to be removed.
Removes one or more members from a sorted set. Deletes the sorted set if all members were removed.
Ref. https://redis.io/commands/zrem/ for more info.
zremrangebylex
(zremrangebylex key min max)
`ZREMRANGEBYLEX` - Redis command function.
Available since: Redis 2.8.9
Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements removed by the operation.
Removes members in a sorted set within a lexicographical range. Deletes the sorted set if all members were removed.
Ref. https://redis.io/commands/zremrangebylex/ for more info.
zremrangebyrank
(zremrangebyrank key start stop)
`ZREMRANGEBYRANK` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements removed by the operation.
Removes members in a sorted set within a range of indexes. Deletes the sorted set if all members were removed.
Ref. https://redis.io/commands/zremrangebyrank/ for more info.
zremrangebyscore
(zremrangebyscore key min max)
`ZREMRANGEBYSCORE` - Redis command function.
Available since: Redis 1.2.0
Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements removed by the operation.
Removes members in a sorted set within a range of scores. Deletes the sorted set if all members were removed.
Ref. https://redis.io/commands/zremrangebyscore/ for more info.
zrevrange
(zrevrange key start stop)
(zrevrange key start stop & args)
`ZREVRANGE` - Redis command function.
Available since: Redis 1.2.0
Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements returned.
Returns members in a sorted set within a range of indexes in reverse order.
Ref. https://redis.io/commands/zrevrange/ for more info.
zrevrangebylex
(zrevrangebylex key max min)
(zrevrangebylex key max min & args)
`ZREVRANGEBYLEX` - Redis command function.
Available since: Redis 2.8.9
Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned. If M is constant (e.g. always asking for the first 10 elements with LIMIT), you can consider it O(log(N)).
Returns members in a sorted set within a lexicographical range in reverse order.
Ref. https://redis.io/commands/zrevrangebylex/ for more info.
zrevrangebyscore
(zrevrangebyscore key max min)
(zrevrangebyscore key max min & args)
`ZREVRANGEBYSCORE` - Redis command function.
Available since: Redis 2.2.0
Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned. If M is constant (e.g. always asking for the first 10 elements with LIMIT), you can consider it O(log(N)).
Returns members in a sorted set within a range of scores in reverse order.
Ref. https://redis.io/commands/zrevrangebyscore/ for more info.
zrevrank
(zrevrank key member)
(zrevrank key member & args)
`ZREVRANK` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(log(N))
Returns the index of a member in a sorted set ordered by descending scores.
Ref. https://redis.io/commands/zrevrank/ for more info.
zscan
(zscan key cursor)
(zscan key cursor & args)
`ZSCAN` - Redis command function.
Available since: Redis 2.8.0
Complexity: 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.
Iterates over members and scores of a sorted set.
Ref. https://redis.io/commands/zscan/ for more info.
zscore
(zscore key member)
`ZSCORE` - Redis command function.
Available since: Redis 1.2.0
Complexity: O(1)
Returns the score of a member in a sorted set.
Ref. https://redis.io/commands/zscore/ for more info.
zunion
(zunion numkeys key)
(zunion numkeys key & args)
`ZUNION` - Redis command function.
Available since: Redis 6.2.0
Complexity: O(N)+O(M*log(M)) with N being the sum of the sizes of the input sorted sets, and M being the number of elements in the resulting sorted set.
Returns the union of multiple sorted sets.
Ref. https://redis.io/commands/zunion/ for more info.
zunionstore
(zunionstore destination numkeys key)
(zunionstore destination numkeys key & args)
`ZUNIONSTORE` - Redis command function.
Available since: Redis 2.0.0
Complexity: O(N)+O(M log(M)) with N being the sum of the sizes of the input sorted sets, and M being the number of elements in the resulting sorted set.
Stores the union of multiple sorted sets in a key.
Ref. https://redis.io/commands/zunionstore/ for more info.
zunionstore*
(zunionstore* dest-key source-keys & opts)
Like `zunionstore` but automatically counts keys.