# 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]})`

Implementation detail.

### acl

`(acl)`

A container for Access List Control commands . ACL Available since: 6.0.0. Time complexity: Depends on subcommand.

### acl-cat

`(acl-cat)`

`(acl-cat & args)`

List the ACL categories or the commands inside a category. ACL CAT [categoryname] Available since: 6.0.0. Time complexity: O(1) since the categories and commands are a fixed set.

### acl-deluser

`(acl-deluser username)`

`(acl-deluser username & args)`

Remove the specified ACL users and the associated rules. ACL DELUSER username [username ...] Available since: 6.0.0. Time complexity: O(1) amortized time considering the typical user.

### acl-dryrun

`(acl-dryrun username command)`

`(acl-dryrun username command & args)`

Returns whether the user can execute the given command without executing the command.. ACL DRYRUN username command [arg [arg ...]] Available since: 7.0.0. Time complexity: O(1).

### acl-genpass

`(acl-genpass)`

`(acl-genpass & args)`

Generate a pseudorandom secure password to use for ACL users. ACL GENPASS [bits] Available since: 6.0.0. Time complexity: O(1)

### acl-getuser

`(acl-getuser username)`

Get the rules for a specific ACL user. ACL GETUSER username Available since: 6.0.0. Time complexity: O(N). Where N is the number of password, command and pattern rules that the user has.

### acl-help

`(acl-help)`

Show helpful text about the different subcommands. ACL HELP Available since: 6.0.0. Time complexity: O(1)

### acl-list

`(acl-list)`

List the current ACL rules in ACL config file format. ACL LIST Available since: 6.0.0. Time complexity: O(N). Where N is the number of configured users.

### acl-load

`(acl-load)`

Reload the ACLs from the configured ACL file. ACL LOAD Available since: 6.0.0. Time complexity: O(N). Where N is the number of configured users.

### acl-log

`(acl-log)`

`(acl-log & args)`

List latest events denied because of ACLs in place. ACL LOG [operation] Available since: 6.0.0. Time complexity: O(N) with N being the number of entries shown.

### acl-save

`(acl-save)`

Save the current ACL rules in the configured ACL file. ACL SAVE Available since: 6.0.0. Time complexity: O(N). Where N is the number of configured users.

### acl-setuser

`(acl-setuser username)`

`(acl-setuser username & args)`

Modify or create the rules for a specific ACL user. ACL SETUSER username [rule [rule ...]] Available since: 6.0.0. Time complexity: O(N). Where N is the number of rules provided.

### acl-users

`(acl-users)`

List the username of all the configured ACL rules. ACL USERS Available since: 6.0.0. Time complexity: O(N). Where N is the number of configured users.

### acl-whoami

`(acl-whoami)`

Return the name of the user associated to the current connection. ACL WHOAMI Available since: 6.0.0. Time complexity: O(1)

### append

`(append key value)`

Append a value to a key. APPEND key value Available since: 2.0.0. Time 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.

### as-bool

`(as-bool x)`

### as-double

DEPRECATED: Use `as-float` instead.

### as-float

`(as-float x)`

### as-int

`(as-int x)`

### as-long

DEPRECATED: Use `as-int` instead.

### as-map

`(as-map x)`

### asking

`(asking)`

Sent by cluster clients after an -ASK redirect. ASKING Available since: 3.0.0. Time complexity: O(1)

### 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

`(atomically watch-keys & body)`

DEPRECATED: Use `atomic` instead.

### auth

`(auth)`

`(auth & args)`

Authenticate to the server. AUTH [username] password Available since: 1.0.0. Time complexity: O(N) where N is the number of passwords defined for the user

### bgrewriteaof

`(bgrewriteaof)`

Asynchronously rewrite the append-only file. BGREWRITEAOF Available since: 1.0.0. Time complexity: O(1)

### bgsave

`(bgsave)`

`(bgsave & args)`

Asynchronously save the dataset to disk. BGSAVE [schedule] Available since: 1.0.0. Time complexity: O(1)

### bitcount

`(bitcount key)`

`(bitcount key & args)`

Count set bits in a string. BITCOUNT key [index] Available since: 2.6.0. Time complexity: O(N)

### bitfield

`(bitfield key operation)`

`(bitfield key operation & args)`

Perform arbitrary bitfield integer operations on strings. BITFIELD key operation [operation ...] Available since: 3.2.0. Time complexity: O(1) for each subcommand specified

### bitfield_ro

`(bitfield_ro key encoding_offset)`

`(bitfield_ro key encoding_offset & args)`

Perform arbitrary bitfield integer operations on strings. Read-only variant of BITFIELD. BITFIELD_RO key encoding_offset [encoding_offset ...] Available since: 6.0.0. Time complexity: O(1) for each subcommand specified

### bitop

`(bitop operation destkey key)`

`(bitop operation destkey key & args)`

Perform bitwise operations between strings. BITOP operation destkey key [key ...] Available since: 2.6.0. Time complexity: O(N)

### bitpos

`(bitpos key bit)`

`(bitpos key bit & args)`

Find first bit set or clear in a string. BITPOS key bit [index] Available since: 2.8.7. Time complexity: O(N)

### blmove

`(blmove source destination wherefrom whereto timeout)`

Pop an element from a list, push it to another list and return it; or block until one is available. BLMOVE source destination wherefrom whereto timeout Available since: 6.2.0. Time complexity: O(1)

### blmpop

`(blmpop timeout numkeys key)`

`(blmpop timeout numkeys key & args)`

Pop elements from a list, or block until one is available. BLMPOP timeout numkeys key [key ...] where [count] Available since: 7.0.0. Time complexity: O(N+M) where N is the number of provided keys and M is the number of elements returned.

### blpop

`(blpop key)`

`(blpop key & args)`

Remove and get the first element in a list, or block until one is available. BLPOP key [key ...] timeout Available since: 2.0.0. Time complexity: O(N) where N is the number of provided keys.

### brpop

`(brpop key)`

`(brpop key & args)`

Remove and get the last element in a list, or block until one is available. BRPOP key [key ...] timeout Available since: 2.0.0. Time complexity: O(N) where N is the number of provided keys.

### brpoplpush

`(brpoplpush source destination timeout)`

Pop an element from a list, push it to another list and return it; or block until one is available. BRPOPLPUSH source destination timeout Available since: 2.2.0. Time complexity: O(1)

### bzmpop

`(bzmpop timeout numkeys key)`

`(bzmpop timeout numkeys key & args)`

Remove and return members with scores in a sorted set or block until one is available. BZMPOP timeout numkeys key [key ...] where [count] Available since: 7.0.0. Time 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.

### bzpopmax

`(bzpopmax key)`

`(bzpopmax key & args)`

Remove and return the member with the highest score from one or more sorted sets, or block until one is available. BZPOPMAX key [key ...] timeout Available since: 5.0.0. Time complexity: O(log(N)) with N being the number of elements in the sorted set.

### bzpopmin

`(bzpopmin key)`

`(bzpopmin key & args)`

Remove and return the member with the lowest score from one or more sorted sets, or block until one is available. BZPOPMIN key [key ...] timeout Available since: 5.0.0. Time complexity: O(log(N)) with N being the number of elements in the sorted set.

### client

`(client)`

A container for client connection commands. CLIENT Available since: 2.4.0. Time complexity: Depends on subcommand.

### client-caching

`(client-caching mode)`

Instruct the server about tracking or not keys in the next request. CLIENT CACHING mode Available since: 6.0.0. Time complexity: O(1)

### client-getname

`(client-getname)`

Get the current connection name. CLIENT GETNAME Available since: 2.6.9. Time complexity: O(1)

### client-getredir

`(client-getredir)`

Get tracking notifications redirection client ID if any. CLIENT GETREDIR Available since: 6.0.0. Time complexity: O(1)

### client-help

`(client-help)`

Show helpful text about the different subcommands. CLIENT HELP Available since: 5.0.0. Time complexity: O(1)

### client-id

`(client-id)`

Returns the client ID for the current connection. CLIENT ID Available since: 5.0.0. Time complexity: O(1)

### client-info

`(client-info)`

Returns information about the current client connection.. CLIENT INFO Available since: 6.2.0. Time complexity: O(1)

### client-kill

`(client-kill filter)`

Kill the connection of a client. CLIENT KILL filter Available since: 2.4.0. Time complexity: O(N) where N is the number of client connections

### client-list

`(client-list)`

`(client-list & args)`

Get the list of client connections. CLIENT LIST [normal_master_replica_pubsub] [id] Available since: 2.4.0. Time complexity: O(N) where N is the number of client connections

### client-no-evict

`(client-no-evict enabled)`

Set client eviction mode for the current connection. CLIENT NO-EVICT enabled Available since: 7.0.0. Time complexity: O(1)

### client-pause

`(client-pause timeout)`

`(client-pause timeout & args)`

Stop processing commands from clients for some time. CLIENT PAUSE timeout [mode] Available since: 2.9.50. Time complexity: O(1)

### client-reply

`(client-reply on_off_skip)`

Instruct the server whether to reply to commands. CLIENT REPLY on_off_skip Available since: 3.2.0. Time complexity: O(1)

### client-setname

`(client-setname connection-name)`

Set the current connection name. CLIENT SETNAME connection-name Available since: 2.6.9. Time complexity: O(1)

### client-tracking

`(client-tracking status)`

`(client-tracking status & args)`

Enable or disable server assisted client side caching support. CLIENT TRACKING status [client-id] [prefix [prefix ...]] [bcast] [optin] [optout] [noloop] Available since: 6.0.0. Time complexity: O(1). Some options may introduce additional complexity.

### client-trackinginfo

`(client-trackinginfo)`

Return information about server assisted client side caching for the current connection. CLIENT TRACKINGINFO Available since: 6.2.0. Time complexity: O(1)

### client-unblock

`(client-unblock client-id)`

`(client-unblock client-id & args)`

Unblock a client blocked in a blocking command from a different connection. CLIENT UNBLOCK client-id [timeout_error] Available since: 5.0.0. Time complexity: O(log N) where N is the number of client connections

### client-unpause

`(client-unpause)`

Resume processing of clients that were paused. CLIENT UNPAUSE Available since: 6.2.0. Time complexity: O(N) Where N is the number of paused clients

### close-listener

`(close-listener listener)`

### cluster

`(cluster)`

A container for cluster commands. CLUSTER Available since: 3.0.0. Time complexity: Depends on subcommand.

### cluster-addslots

`(cluster-addslots slot)`

`(cluster-addslots slot & args)`

Assign new hash slots to receiving node. CLUSTER ADDSLOTS slot [slot ...] Available since: 3.0.0. Time complexity: O(N) where N is the total number of hash slot arguments

### cluster-addslotsrange

`(cluster-addslotsrange start-slot_end-slot)`

`(cluster-addslotsrange start-slot_end-slot & args)`

Assign new hash slots to receiving node. CLUSTER ADDSLOTSRANGE start-slot_end-slot [start-slot_end-slot ...] Available since: 7.0.0. Time complexity: O(N) where N is the total number of the slots between the start slot and end slot arguments.

### cluster-bumpepoch

`(cluster-bumpepoch)`

Advance the cluster config epoch. CLUSTER BUMPEPOCH Available since: 3.0.0. Time complexity: O(1)

### cluster-count-failure-reports

`(cluster-count-failure-reports node-id)`

Return the number of failure reports active for a given node. CLUSTER COUNT-FAILURE-REPORTS node-id Available since: 3.0.0. Time complexity: O(N) where N is the number of failure reports

### cluster-countkeysinslot

`(cluster-countkeysinslot slot)`

Return the number of local keys in the specified hash slot. CLUSTER COUNTKEYSINSLOT slot Available since: 3.0.0. Time complexity: O(1)

### cluster-delslots

`(cluster-delslots slot)`

`(cluster-delslots slot & args)`

Set hash slots as unbound in receiving node. CLUSTER DELSLOTS slot [slot ...] Available since: 3.0.0. Time complexity: O(N) where N is the total number of hash slot arguments

### cluster-delslotsrange

`(cluster-delslotsrange start-slot_end-slot)`

`(cluster-delslotsrange start-slot_end-slot & args)`

Set hash slots as unbound in receiving node. CLUSTER DELSLOTSRANGE start-slot_end-slot [start-slot_end-slot ...] Available since: 7.0.0. Time complexity: O(N) where N is the total number of the slots between the start slot and end slot arguments.

### cluster-failover

`(cluster-failover)`

`(cluster-failover & args)`

Forces a replica to perform a manual failover of its master.. CLUSTER FAILOVER [options] Available since: 3.0.0. Time complexity: O(1)

### cluster-flushslots

`(cluster-flushslots)`

Delete a node's own slots information. CLUSTER FLUSHSLOTS Available since: 3.0.0. Time complexity: O(1)

### cluster-forget

`(cluster-forget node-id)`

Remove a node from the nodes table. CLUSTER FORGET node-id Available since: 3.0.0. Time complexity: O(1)

### cluster-getkeysinslot

`(cluster-getkeysinslot slot count)`

Return local key names in the specified hash slot. CLUSTER GETKEYSINSLOT slot count Available since: 3.0.0. Time complexity: O(log(N)) where N is the number of requested keys

### cluster-help

`(cluster-help)`

Show helpful text about the different subcommands. CLUSTER HELP Available since: 5.0.0. Time complexity: O(1)

### cluster-info

`(cluster-info)`

Provides info about Redis Cluster node state. CLUSTER INFO Available since: 3.0.0. Time complexity: O(1)

### cluster-keyslot

`(cluster-keyslot key)`

Returns the hash slot of the specified key. CLUSTER KEYSLOT key Available since: 3.0.0. Time complexity: O(N) where N is the number of bytes in the key

### cluster-links

`(cluster-links)`

Returns a list of all TCP links to and from peer nodes in cluster. CLUSTER LINKS Available since: 7.0.0. Time complexity: O(N) where N is the total number of Cluster nodes

### cluster-meet

`(cluster-meet ip port)`

`(cluster-meet ip port & args)`

Force a node cluster to handshake with another node. CLUSTER MEET ip port [cluster_bus_port] Available since: 3.0.0. Time complexity: O(1)

### cluster-myid

`(cluster-myid)`

Return the node id. CLUSTER MYID Available since: 3.0.0. Time complexity: O(1)

### cluster-nodes

`(cluster-nodes)`

Get Cluster config for the node. CLUSTER NODES Available since: 3.0.0. Time complexity: O(N) where N is the total number of Cluster nodes

### cluster-replicas

`(cluster-replicas node-id)`

List replica nodes of the specified master node. CLUSTER REPLICAS node-id Available since: 5.0.0. Time complexity: O(1)

### cluster-replicate

`(cluster-replicate node-id)`

Reconfigure a node as a replica of the specified master node. CLUSTER REPLICATE node-id Available since: 3.0.0. Time complexity: O(1)

### cluster-reset

`(cluster-reset)`

`(cluster-reset & args)`

Reset a Redis Cluster node. CLUSTER RESET [hard_soft] Available since: 3.0.0. Time complexity: O(N) where N is the number of known nodes. The command may execute a FLUSHALL as a side effect.

### cluster-saveconfig

`(cluster-saveconfig)`

Forces the node to save cluster state on disk. CLUSTER SAVECONFIG Available since: 3.0.0. Time complexity: O(1)

### cluster-set-config-epoch

`(cluster-set-config-epoch config-epoch)`

Set the configuration epoch in a new node. CLUSTER SET-CONFIG-EPOCH config-epoch Available since: 3.0.0. Time complexity: O(1)

### cluster-setslot

`(cluster-setslot slot subcommand)`

Bind a hash slot to a specific node. CLUSTER SETSLOT slot subcommand Available since: 3.0.0. Time complexity: O(1)

### cluster-shards

`(cluster-shards)`

Get array of cluster slots to node mappings. CLUSTER SHARDS Available since: 7.0.0. Time complexity: O(N) where N is the total number of cluster nodes

### cluster-slaves

`(cluster-slaves node-id)`

List replica nodes of the specified master node. CLUSTER SLAVES node-id Available since: 3.0.0. Time complexity: O(1)

### cluster-slots

`(cluster-slots)`

Get array of Cluster slot to node mappings. CLUSTER SLOTS Available since: 3.0.0. Time complexity: O(N) where N is the total number of Cluster nodes

### command

`(command)`

Get array of Redis command details. COMMAND Available since: 2.8.13. Time complexity: O(N) where N is the total number of Redis commands

### command-count

`(command-count)`

Get total number of Redis commands. COMMAND COUNT Available since: 2.8.13. Time complexity: O(1)

### command-docs

`(command-docs)`

`(command-docs & args)`

Get array of specific Redis command documentation. COMMAND DOCS [command-name [command-name ...]] Available since: 7.0.0. Time complexity: O(N) where N is the number of commands to look up

### command-getkeys

`(command-getkeys)`

Extract keys given a full Redis command. COMMAND GETKEYS Available since: 2.8.13. Time complexity: O(N) where N is the number of arguments to the command

### command-getkeysandflags

`(command-getkeysandflags)`

Extract keys and access flags given a full Redis command. COMMAND GETKEYSANDFLAGS Available since: 7.0.0. Time complexity: O(N) where N is the number of arguments to the command

### command-help

`(command-help)`

Show helpful text about the different subcommands. COMMAND HELP Available since: 5.0.0. Time complexity: O(1)

### command-info

`(command-info)`

`(command-info & args)`

Get array of specific Redis command details, or all when no argument is given.. COMMAND INFO [command-name [command-name ...]] Available since: 2.8.13. Time complexity: O(N) where N is the number of commands to look up

### command-list

`(command-list)`

`(command-list & args)`

Get an array of Redis command names. COMMAND LIST [filterby] Available since: 7.0.0. Time complexity: O(N) where N is the total number of Redis commands

### compare-and-hset

`(compare-and-hset k field old-val new-val)`

`(compare-and-hset k field old-val ?sha new-val)`

Experimental.

### compare-and-set

`(compare-and-set k old-val new-val)`

`(compare-and-set k old-val ?sha new-val)`

Experimental.

### config

`(config)`

A container for server configuration commands. CONFIG Available since: 2.0.0. Time complexity: Depends on subcommand.

### config-get

`(config-get parameter)`

`(config-get parameter & args)`

Get the values of configuration parameters. CONFIG GET parameter [parameter ...] Available since: 2.0.0. Time complexity: O(N) when N is the number of configuration parameters provided

### config-help

`(config-help)`

Show helpful text about the different subcommands. CONFIG HELP Available since: 5.0.0. Time complexity: O(1)

### config-resetstat

`(config-resetstat)`

Reset the stats returned by INFO. CONFIG RESETSTAT Available since: 2.0.0. Time complexity: O(1)

### config-rewrite

`(config-rewrite)`

Rewrite the configuration file with the in memory configuration. CONFIG REWRITE Available since: 2.8.0. Time complexity: O(1)

### config-set

`(config-set parameter_value)`

`(config-set parameter_value & args)`

Set configuration parameters to the given values. CONFIG SET parameter_value [parameter_value ...] Available since: 2.0.0. Time complexity: O(N) when N is the number of configuration parameters provided

### 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 returning 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 a key. COPY source destination [destination-db] [replace] Available since: 6.2.0. Time complexity: O(N) worst case for collections, where N is the number of nested items. O(1) for string values.

### dbsize

`(dbsize)`

Return the number of keys in the selected database. DBSIZE Available since: 1.0.0. Time complexity: O(1)

### debug

`(debug)`

A container for debugging commands. DEBUG Available since: 1.0.0. Time complexity: Depends on subcommand.

### decr

`(decr key)`

Decrement the integer value of a key by one. DECR key Available since: 1.0.0. Time complexity: O(1)

### decrby

`(decrby key decrement)`

Decrement the integer value of a key by the given number. DECRBY key decrement Available since: 1.0.0. Time complexity: O(1)

### del

`(del key)`

`(del key & args)`

Delete a key. DEL key [key ...] Available since: 1.0.0. Time 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).

### discard

`(discard)`

Discard all commands issued after MULTI. DISCARD Available since: 2.0.0. Time complexity: O(N), when N is the number of queued commands

### dump

`(dump key)`

Return a serialized version of the value stored at the specified key.. DUMP key Available since: 2.6.0. Time 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).

### echo

`(echo message)`

Echo the given string. ECHO message Available since: 1.0.0. Time complexity: O(1)

### ensure-atomically

#### macro

`(ensure-atomically {:keys [max-tries], :or {max-tries 100}} watch-keys & body)`

DEPRECATED: Use `atomic` instead.

### eval

`(eval script numkeys)`

`(eval script numkeys & args)`

Execute a Lua script server side. EVAL script numkeys [key [key ...]] [arg [arg ...]] Available since: 2.6.0. Time complexity: Depends on the script that is executed.

### 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)`

Execute a read-only Lua script server side. EVAL_RO script numkeys [key [key ...]] [arg [arg ...]] Available since: 7.0.0. Time complexity: Depends on the script that is executed.

### evalsha

`(evalsha sha1 numkeys)`

`(evalsha sha1 numkeys & args)`

Execute a Lua script server side. EVALSHA sha1 numkeys [key [key ...]] [arg [arg ...]] Available since: 2.6.0. Time complexity: Depends on the script that is executed.

### 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)`

Execute a read-only Lua script server side. EVALSHA_RO sha1 numkeys [key [key ...]] [arg [arg ...]] Available since: 7.0.0. Time complexity: Depends on the script that is executed.

### exec

`(exec)`

Execute all commands issued after MULTI. EXEC Available since: 1.2.0. Time complexity: Depends on commands in the transaction

### exists

`(exists key)`

`(exists key & args)`

Determine if a key exists. EXISTS key [key ...] Available since: 1.0.0. Time complexity: O(N) where N is the number of keys to check.

### expire

`(expire key seconds)`

`(expire key seconds & args)`

Set a key's time to live in seconds. EXPIRE key seconds [condition] Available since: 1.0.0. Time complexity: O(1)

### expireat

`(expireat key unix-time-seconds)`

`(expireat key unix-time-seconds & args)`

Set the expiration for a key as a UNIX timestamp. EXPIREAT key unix-time-seconds [condition] Available since: 1.2.0. Time complexity: O(1)

### expiretime

`(expiretime key)`

Get the expiration Unix timestamp for a key. EXPIRETIME key Available since: 7.0.0. Time complexity: O(1)

### failover

`(failover)`

`(failover & args)`

Start a coordinated failover between this server and one of its replicas.. FAILOVER [target] [abort] [milliseconds] Available since: 6.2.0. Time complexity: O(1)

### fcall

`(fcall function numkeys)`

`(fcall function numkeys & args)`

Invoke a function. FCALL function numkeys [key [key ...]] [arg [arg ...]] Available since: 7.0.0. Time complexity: Depends on the function that is executed.

### fcall_ro

`(fcall_ro function numkeys)`

`(fcall_ro function numkeys & args)`

Invoke a read-only function. FCALL_RO function numkeys [key [key ...]] [arg [arg ...]] Available since: 7.0.0. Time complexity: Depends on the function that is executed.

### flushall

`(flushall)`

`(flushall & args)`

Remove all keys from all databases. FLUSHALL [async] Available since: 1.0.0. Time complexity: O(N) where N is the total number of keys in all databases

### flushdb

`(flushdb)`

`(flushdb & args)`

Remove all keys from the current database. FLUSHDB [async] Available since: 1.0.0. Time complexity: O(N) where N is the number of keys in the selected database

### freeze

`(freeze x)`

`(freeze x opts)`

Forces argument of any type (incl. keywords, simple numbers, and binary types) to be subject to automatic de/serialization with Nippy.

### function

`(function)`

A container for function commands. FUNCTION Available since: 7.0.0. Time complexity: Depends on subcommand.

### function-delete

`(function-delete library-name)`

Delete a function by name. FUNCTION DELETE library-name Available since: 7.0.0. Time complexity: O(1)

### function-dump

`(function-dump)`

Dump all functions into a serialized binary payload. FUNCTION DUMP Available since: 7.0.0. Time complexity: O(N) where N is the number of functions

### function-flush

`(function-flush)`

`(function-flush & args)`

Deleting all functions. FUNCTION FLUSH [async] Available since: 7.0.0. Time complexity: O(N) where N is the number of functions deleted

### function-help

`(function-help)`

Show helpful text about the different subcommands. FUNCTION HELP Available since: 7.0.0. Time complexity: O(1)

### function-kill

`(function-kill)`

Kill the function currently in execution.. FUNCTION KILL Available since: 7.0.0. Time complexity: O(1)

### function-list

`(function-list)`

`(function-list & args)`

List information about all the functions. FUNCTION LIST [library-name-pattern] [withcode] Available since: 7.0.0. Time complexity: O(N) where N is the number of functions

### function-load

`(function-load)`

`(function-load & args)`

Create a function with the given arguments (name, code, description). FUNCTION LOAD [replace] function-code Available since: 7.0.0. Time complexity: O(1) (considering compilation time is redundant)

### function-restore

`(function-restore serialized-value)`

`(function-restore serialized-value & args)`

Restore all the functions on the given payload. FUNCTION RESTORE serialized-value [policy] Available since: 7.0.0. Time complexity: O(N) where N is the number of functions on the payload

### function-stats

`(function-stats)`

Return information about the function currently running (name, description, duration). FUNCTION STATS Available since: 7.0.0. Time complexity: O(1)

### geoadd

`(geoadd key)`

`(geoadd key & args)`

Add one or more geospatial items in the geospatial index represented using a sorted set. GEOADD key [condition] [change] longitude_latitude_member [longitude_latitude_member ...] Available since: 3.2.0. Time complexity: O(log(N)) for each item added, where N is the number of elements in the sorted set.

### geodist

`(geodist key member1 member2)`

`(geodist key member1 member2 & args)`

Returns the distance between two members of a geospatial index. GEODIST key member1 member2 [unit] Available since: 3.2.0. Time complexity: O(log(N))

### geohash

`(geohash key member)`

`(geohash key member & args)`

Returns members of a geospatial index as standard geohash strings. GEOHASH key member [member ...] Available since: 3.2.0. Time complexity: O(log(N)) for each member requested, where N is the number of elements in the sorted set.

### geopos

`(geopos key member)`

`(geopos key member & args)`

Returns longitude and latitude of members of a geospatial index. GEOPOS key member [member ...] Available since: 3.2.0. Time complexity: O(N) where N is the number of members requested.

### georadius

`(georadius key longitude latitude radius unit)`

`(georadius key longitude latitude radius unit & args)`

Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point. GEORADIUS key longitude latitude radius unit [withcoord] [withdist] [withhash] [count] [order] [key] [key] Available since: 3.2.0. Time 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.

### georadius_ro

`(georadius_ro key longitude latitude radius unit)`

`(georadius_ro key longitude latitude radius unit & args)`

A read-only variant for GEORADIUS. GEORADIUS_RO key longitude latitude radius unit [withcoord] [withdist] [withhash] [count] [order] Available since: 3.2.10. Time 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.

### georadiusbymember

`(georadiusbymember key member radius unit)`

`(georadiusbymember key member radius unit & args)`

Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member. GEORADIUSBYMEMBER key member radius unit [withcoord] [withdist] [withhash] [count] [order] [key] [key] Available since: 3.2.0. Time 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.

### georadiusbymember_ro

`(georadiusbymember_ro key member radius unit)`

`(georadiusbymember_ro key member radius unit & args)`

A read-only variant for GEORADIUSBYMEMBER. GEORADIUSBYMEMBER_RO key member radius unit [withcoord] [withdist] [withhash] [count] [order] Available since: 3.2.10. Time 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.

### geosearch

`(geosearch key from by)`

`(geosearch key from by & args)`

Query a sorted set representing a geospatial index to fetch members inside an area of a box or a circle.. GEOSEARCH key from by [order] [count] [withcoord] [withdist] [withhash] Available since: 6.2.0. Time 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

### geosearchstore

`(geosearchstore destination source from by)`

`(geosearchstore destination source from by & args)`

Query a sorted set representing a geospatial index to fetch members inside an area of a box or a circle, and store the result in another key.. GEOSEARCHSTORE destination source from by [order] [count] [storedist] Available since: 6.2.0. Time 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

### get

`(get key)`

Get the value of a key. GET key Available since: 1.0.0. Time complexity: O(1)

### getbit

`(getbit key offset)`

Returns the bit value at offset in the string value stored at key. GETBIT key offset Available since: 2.2.0. Time complexity: O(1)

### getdel

`(getdel key)`

Get the value of a key and delete the key. GETDEL key Available since: 6.2.0. Time complexity: O(1)

### getex

`(getex key)`

`(getex key & args)`

Get the value of a key and optionally set its expiration. GETEX key [expiration] Available since: 6.2.0. Time complexity: O(1)

### getrange

`(getrange key start end)`

Get a substring of the string stored at a key. GETRANGE key start end Available since: 2.4.0. Time 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.

### getset

`(getset key value)`

Set the string value of a key and return its old value. GETSET key value Available since: 1.0.0. Time complexity: O(1)

### hash-script

DEPRECATED: Use `script-hash` instead.

### hdel

`(hdel key field)`

`(hdel key field & args)`

Delete one or more hash fields. HDEL key field [field ...] Available since: 2.0.0. Time complexity: O(N) where N is the number of fields to be removed.

### hello

`(hello)`

`(hello & args)`

Handshake with Redis. HELLO [arguments] Available since: 6.0.0. Time complexity: O(1)

### hexists

`(hexists key field)`

Determine if a hash field exists. HEXISTS key field Available since: 2.0.0. Time complexity: O(1)

### hget

`(hget key field)`

Get the value of a hash field. HGET key field Available since: 2.0.0. Time complexity: O(1)

### hgetall

`(hgetall key)`

Get all the fields and values in a hash. HGETALL key Available since: 2.0.0. Time complexity: O(N) where N is the size of the hash.

### hgetall*

`(hgetall* key & [keywordize?])`

DEPRECATED: Use `parse-map` instead.

### hincrby

`(hincrby key field increment)`

Increment the integer value of a hash field by the given number. HINCRBY key field increment Available since: 2.0.0. Time complexity: O(1)

### hincrbyfloat

`(hincrbyfloat key field increment)`

Increment the float value of a hash field by the given amount. HINCRBYFLOAT key field increment Available since: 2.6.0. Time complexity: O(1)

### hkeys

`(hkeys key)`

Get all the fields in a hash. HKEYS key Available since: 2.0.0. Time complexity: O(N) where N is the size of the hash.

### hlen

`(hlen key)`

Get the number of fields in a hash. HLEN key Available since: 2.0.0. Time complexity: O(1)

### hmget

`(hmget key field)`

`(hmget key field & args)`

Get the values of all the given hash fields. HMGET key field [field ...] Available since: 2.0.0. Time complexity: O(N) where N is the number of fields being requested.

### hmget*

`(hmget* key field & more)`

DEPRECATED: Use `parse-map` instead.

### hmset

`(hmset key field_value)`

`(hmset key field_value & args)`

Set multiple hash fields to multiple values. HMSET key field_value [field_value ...] Available since: 2.0.0. Time complexity: O(N) where N is the number of fields being set.

### hmset*

`(hmset* key m)`

Like `hmset` but takes a map argument.

### hmsetnx

Experimental.

### hrandfield

`(hrandfield key)`

`(hrandfield key & args)`

Get one or multiple random fields from a hash. HRANDFIELD key [options] Available since: 6.2.0. Time complexity: O(N) where N is the number of fields returned

### hscan

`(hscan key cursor)`

`(hscan key cursor & args)`

Incrementally iterate hash fields and associated values. HSCAN key cursor [pattern] [count] Available since: 2.8.0. Time 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..

### hset

`(hset key field_value)`

`(hset key field_value & args)`

Set the string value of a hash field. HSET key field_value [field_value ...] Available since: 2.0.0. Time 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.

### hsetnx

`(hsetnx key field value)`

Set the value of a hash field, only if the field does not exist. HSETNX key field value Available since: 2.0.0. Time complexity: O(1)

### hstrlen

`(hstrlen key field)`

Get the length of the value of a hash field. HSTRLEN key field Available since: 3.2.0. Time complexity: O(1)

### hswap

Experimental.

### hvals

`(hvals key)`

Get all the values in a hash. HVALS key Available since: 2.0.0. Time complexity: O(N) where N is the size of the hash.

### incr

`(incr key)`

Increment the integer value of a key by one. INCR key Available since: 1.0.0. Time complexity: O(1)

### incrby

`(incrby key increment)`

Increment the integer value of a key by the given amount. INCRBY key increment Available since: 1.0.0. Time complexity: O(1)

### incrbyfloat

`(incrbyfloat key increment)`

Increment the float value of a key by the given amount. INCRBYFLOAT key increment Available since: 2.6.0. Time complexity: O(1)

### info

`(info)`

`(info & args)`

Get information and statistics about the server. INFO [section [section ...]] Available since: 1.0.0. Time complexity: O(1)

### 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.).

### key*

`(key* parts)`

### keys

`(keys pattern)`

Find all keys matching the given pattern. KEYS pattern Available since: 1.0.0. Time 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.

### kname

`(kname & parts)`

DEPRECATED: Use `key` instead. `key` does not filter nil parts.

### lastsave

`(lastsave)`

Get the UNIX time stamp of the last successful save to disk. LASTSAVE Available since: 1.0.0. Time complexity: O(1)

### latency

`(latency)`

A container for latency diagnostics commands. LATENCY Available since: 2.8.13. Time complexity: Depends on subcommand.

### latency-doctor

`(latency-doctor)`

Return a human readable latency analysis report.. LATENCY DOCTOR Available since: 2.8.13. Time complexity: O(1)

### latency-graph

`(latency-graph event)`

Return a latency graph for the event.. LATENCY GRAPH event Available since: 2.8.13. Time complexity: O(1)

### latency-help

`(latency-help)`

Show helpful text about the different subcommands.. LATENCY HELP Available since: 2.8.13. Time complexity: O(1)

### latency-histogram

`(latency-histogram)`

`(latency-histogram & args)`

Return the cumulative distribution of latencies of a subset of commands or all.. LATENCY HISTOGRAM [command [command ...]] Available since: 7.0.0. Time complexity: O(N) where N is the number of commands with latency information being retrieved.

### latency-history

`(latency-history event)`

Return timestamp-latency samples for the event.. LATENCY HISTORY event Available since: 2.8.13. Time complexity: O(1)

### latency-latest

`(latency-latest)`

Return the latest latency samples for all events.. LATENCY LATEST Available since: 2.8.13. Time complexity: O(1)

### latency-reset

`(latency-reset)`

`(latency-reset & args)`

Reset latency data for one or more events.. LATENCY RESET [event [event ...]] Available since: 2.8.13. Time complexity: O(1)

### lcs

`(lcs key1 key2)`

`(lcs key1 key2 & args)`

Find longest common substring. LCS key1 key2 [len] [idx] [len] [withmatchlen] Available since: 7.0.0. Time complexity: O(N*M) where N and M are the lengths of s1 and s2, respectively

### lindex

`(lindex key index)`

Get an element from a list by its index. LINDEX key index Available since: 1.0.0. Time 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).

### linsert

`(linsert key where pivot element)`

Insert an element before or after another element in a list. LINSERT key where pivot element Available since: 2.2.0. Time 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).

### llen

`(llen key)`

Get the length of a list. LLEN key Available since: 1.0.0. Time complexity: O(1)

### lmove

`(lmove source destination wherefrom whereto)`

Pop an element from a list, push it to another list and return it. LMOVE source destination wherefrom whereto Available since: 6.2.0. Time complexity: O(1)

### lmpop

`(lmpop numkeys key)`

`(lmpop numkeys key & args)`

Pop elements from a list. LMPOP numkeys key [key ...] where [count] Available since: 7.0.0. Time complexity: O(N+M) where N is the number of provided keys and M is the number of elements returned.

### lolwut

`(lolwut)`

`(lolwut & args)`

Display some computer art and the Redis version. LOLWUT [version] Available since: 5.0.0.

### lpop

`(lpop key)`

`(lpop key & args)`

Remove and get the first elements in a list. LPOP key [count] Available since: 1.0.0. Time complexity: O(N) where N is the number of elements returned

### lpos

`(lpos key element)`

`(lpos key element & args)`

Return the index of matching elements on a list. LPOS key element [rank] [num-matches] [len] Available since: 6.0.6. Time 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.

### lpush

`(lpush key element)`

`(lpush key element & args)`

Prepend one or multiple elements to a list. LPUSH key element [element ...] Available since: 1.0.0. Time complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments.

### lpushx

`(lpushx key element)`

`(lpushx key element & args)`

Prepend an element to a list, only if the list exists. LPUSHX key element [element ...] Available since: 2.2.0. Time complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments.

### lrange

`(lrange key start stop)`

Get a range of elements from a list. LRANGE key start stop Available since: 1.0.0. Time 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.

### lrem

`(lrem key count element)`

Remove elements from a list. LREM key count element Available since: 1.0.0. Time complexity: O(N+M) where N is the length of the list and M is the number of elements removed.

### lset

`(lset key index element)`

Set the value of an element in a list by its index. LSET key index element Available since: 1.0.0. Time 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).

### ltrim

`(ltrim key start stop)`

Trim a list to the specified range. LTRIM key start stop Available since: 1.0.0. Time complexity: O(N) where N is the number of elements to be removed by the operation.

### 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

`(lua-script & args)`

DEPRECATED: Use `lua` instead.

### make-conn-pool

`(make-conn-pool & opts)`

DEPRECATED: Use `wcar` instead.

### make-conn-spec

`(make-conn-spec & opts)`

DEPRECATED: Use `wcar` instead.

### make-keyfn

`(make-keyfn & prefix-parts)`

DEPRECATED: Use `kname` instead.

### memory

`(memory)`

A container for memory diagnostics commands. MEMORY Available since: 4.0.0. Time complexity: Depends on subcommand.

### memory-doctor

`(memory-doctor)`

Outputs memory problems report. MEMORY DOCTOR Available since: 4.0.0. Time complexity: O(1)

### memory-help

`(memory-help)`

Show helpful text about the different subcommands. MEMORY HELP Available since: 4.0.0. Time complexity: O(1)

### memory-malloc-stats

`(memory-malloc-stats)`

Show allocator internal stats. MEMORY MALLOC-STATS Available since: 4.0.0. Time complexity: Depends on how much memory is allocated, could be slow

### memory-purge

`(memory-purge)`

Ask the allocator to release memory. MEMORY PURGE Available since: 4.0.0. Time complexity: Depends on how much memory is allocated, could be slow

### memory-stats

`(memory-stats)`

Show memory usage details. MEMORY STATS Available since: 4.0.0. Time complexity: O(1)

### memory-usage

`(memory-usage key)`

`(memory-usage key & args)`

Estimate the memory usage of a key. MEMORY USAGE key [count] Available since: 4.0.0. Time complexity: O(N) where N is the number of samples.

### mget

`(mget key)`

`(mget key & args)`

Get the values of all the given keys. MGET key [key ...] Available since: 1.0.0. Time complexity: O(N) where N is the number of keys to retrieve.

### migrate

`(migrate host port key_or_empty_string destination-db timeout)`

`(migrate host port key_or_empty_string destination-db timeout & args)`

Atomically transfer a key from a Redis instance to another one.. MIGRATE host port key_or_empty_string destination-db timeout [copy] [replace] [authentication] [key [key ...]] Available since: 2.6.0. Time 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.

### module

`(module)`

A container for module commands. MODULE Available since: 4.0.0. Time complexity: Depends on subcommand.

### module-help

`(module-help)`

Show helpful text about the different subcommands. MODULE HELP Available since: 5.0.0. Time complexity: O(1)

### module-list

`(module-list)`

List all modules loaded by the server. MODULE LIST Available since: 4.0.0. Time complexity: O(N) where N is the number of loaded modules.

### module-load

`(module-load path)`

`(module-load path & args)`

Load a module. MODULE LOAD path [arg [arg ...]] Available since: 4.0.0. Time complexity: O(1)

### module-loadex

`(module-loadex path)`

`(module-loadex path & args)`

Load a module with extended parameters. MODULE LOADEX path [configs [configs ...]] [args [args ...]] Available since: 7.0.0. Time complexity: O(1)

### module-unload

`(module-unload name)`

Unload a module. MODULE UNLOAD name Available since: 4.0.0. Time complexity: O(1)

### monitor

`(monitor)`

Listen for all requests received by the server in real time. MONITOR Available since: 1.0.0.

### move

`(move key db)`

Move a key to another database. MOVE key db Available since: 1.0.0. Time complexity: O(1)

### mset

`(mset key_value)`

`(mset key_value & args)`

Set multiple keys to multiple values. MSET key_value [key_value ...] Available since: 1.0.1. Time complexity: O(N) where N is the number of keys to set.

### msetnx

`(msetnx key_value)`

`(msetnx key_value & args)`

Set multiple keys to multiple values, only if none of the keys exist. MSETNX key_value [key_value ...] Available since: 1.0.1. Time complexity: O(N) where N is the number of keys to set.

### multi

`(multi)`

Mark the start of a transaction block. MULTI Available since: 1.2.0. Time complexity: O(1)

### object

`(object)`

A container for object introspection commands. OBJECT Available since: 2.2.3. Time complexity: Depends on subcommand.

### object-encoding

`(object-encoding key)`

Inspect the internal encoding of a Redis object. OBJECT ENCODING key Available since: 2.2.3. Time complexity: O(1)

### object-freq

`(object-freq key)`

Get the logarithmic access frequency counter of a Redis object. OBJECT FREQ key Available since: 4.0.0. Time complexity: O(1)

### object-help

`(object-help)`

Show helpful text about the different subcommands. OBJECT HELP Available since: 6.2.0. Time complexity: O(1)

### object-idletime

`(object-idletime key)`

Get the time since a Redis object was last accessed. OBJECT IDLETIME key Available since: 2.2.3. Time complexity: O(1)

### object-refcount

`(object-refcount key)`

Get the number of references to the value of the key. OBJECT REFCOUNT key Available since: 2.2.3. Time complexity: O(1)

### 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

`(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

`(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)`

Remove the expiration from a key. PERSIST key Available since: 2.2.0. Time complexity: O(1)

### pexpire

`(pexpire key milliseconds)`

`(pexpire key milliseconds & args)`

Set a key's time to live in milliseconds. PEXPIRE key milliseconds [condition] Available since: 2.6.0. Time complexity: O(1)

### pexpireat

`(pexpireat key unix-time-milliseconds)`

`(pexpireat key unix-time-milliseconds & args)`

Set the expiration for a key as a UNIX timestamp specified in milliseconds. PEXPIREAT key unix-time-milliseconds [condition] Available since: 2.6.0. Time complexity: O(1)

### pexpiretime

`(pexpiretime key)`

Get the expiration Unix timestamp for a key in milliseconds. PEXPIRETIME key Available since: 7.0.0. Time complexity: O(1)

### pfadd

`(pfadd key)`

`(pfadd key & args)`

Adds the specified elements to the specified HyperLogLog.. PFADD key [element [element ...]] Available since: 2.8.9. Time complexity: O(1) to add every element.

### pfcount

`(pfcount key)`

`(pfcount key & args)`

Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).. PFCOUNT key [key ...] Available since: 2.8.9. Time 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.

### pfdebug

`(pfdebug subcommand key)`

Internal commands for debugging HyperLogLog values. PFDEBUG subcommand key Available since: 2.8.9. Time complexity: N/A

### pfmerge

`(pfmerge destkey sourcekey)`

`(pfmerge destkey sourcekey & args)`

Merge N different HyperLogLogs into a single one.. PFMERGE destkey sourcekey [sourcekey ...] Available since: 2.8.9. Time complexity: O(N) to merge N HyperLogLogs, but with high constant times.

### pfselftest

`(pfselftest)`

An internal command for testing HyperLogLog values. PFSELFTEST Available since: 2.8.9. Time complexity: N/A

### ping

`(ping)`

`(ping & args)`

Ping the server. PING [message] Available since: 1.0.0. Time complexity: O(1)

### preserve

DEPRECATED: Use `freeze` instead.

### psetex

`(psetex key milliseconds value)`

Set the value and expiration in milliseconds of a key. PSETEX key milliseconds value Available since: 2.6.0. Time complexity: O(1)

### psubscribe

`(psubscribe pattern)`

`(psubscribe pattern & args)`

Listen for messages published to channels matching the given patterns. PSUBSCRIBE pattern [pattern ...] Available since: 2.0.0. Time complexity: O(N) where N is the number of patterns the client is already subscribed to.

### psync

`(psync replicationid offset)`

Internal command used for replication. PSYNC replicationid offset Available since: 2.8.0.

### pttl

`(pttl key)`

Get the time to live for a key in milliseconds. PTTL key Available since: 2.6.0. Time complexity: O(1)

### publish

`(publish channel message)`

Post a message to a channel. PUBLISH channel message Available since: 2.0.0. Time 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).

### pubsub

`(pubsub)`

A container for Pub/Sub commands. PUBSUB Available since: 2.8.0. Time complexity: Depends on subcommand.

### pubsub-channels

`(pubsub-channels)`

`(pubsub-channels & args)`

List active channels. PUBSUB CHANNELS [pattern] Available since: 2.8.0. Time complexity: O(N) where N is the number of active channels, and assuming constant time pattern matching (relatively short channels and patterns)

### pubsub-help

`(pubsub-help)`

Show helpful text about the different subcommands. PUBSUB HELP Available since: 6.2.0. Time complexity: O(1)

### pubsub-numpat

`(pubsub-numpat)`

Get the count of unique patterns pattern subscriptions. PUBSUB NUMPAT Available since: 2.8.0. Time complexity: O(1)

### pubsub-numsub

`(pubsub-numsub)`

`(pubsub-numsub & args)`

Get the count of subscribers for channels. PUBSUB NUMSUB [channel [channel ...]] Available since: 2.8.0. Time complexity: O(N) for the NUMSUB subcommand, where N is the number of requested channels

### pubsub-shardchannels

`(pubsub-shardchannels)`

`(pubsub-shardchannels & args)`

List active shard channels. PUBSUB SHARDCHANNELS [pattern] Available since: 7.0.0. Time complexity: O(N) where N is the number of active shard channels, and assuming constant time pattern matching (relatively short shard channels).

### pubsub-shardnumsub

`(pubsub-shardnumsub)`

`(pubsub-shardnumsub & args)`

Get the count of subscribers for shard channels. PUBSUB SHARDNUMSUB [shardchannel [shardchannel ...]] Available since: 7.0.0. Time complexity: O(N) for the SHARDNUMSUB subcommand, where N is the number of requested shard channels

### punsubscribe

`(punsubscribe)`

`(punsubscribe & args)`

Stop listening for messages posted to channels matching the given patterns. PUNSUBSCRIBE [pattern [pattern ...]] Available since: 2.0.0. Time complexity: O(N+M) where N is the number of patterns the client is already subscribed and M is the number of total patterns subscribed in the system (by any client).

### quit

`(quit)`

Close the connection. QUIT Available since: 1.0.0. Time complexity: O(1)

### randomkey

`(randomkey)`

Return a random key from the keyspace. RANDOMKEY Available since: 1.0.0. Time complexity: O(1)

### raw

`(raw x)`

Forces byte[] argument to be sent to Redis as raw, unencoded bytes.

### readonly

`(readonly)`

Enables read queries for a connection to a cluster replica node. READONLY Available since: 3.0.0. Time complexity: O(1)

### readwrite

`(readwrite)`

Disables read queries for a connection to a cluster replica node. READWRITE Available since: 3.0.0. Time complexity: O(1)

### 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-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: Use `return` instead.

### rename

`(rename key newkey)`

Rename a key. RENAME key newkey Available since: 1.0.0. Time complexity: O(1)

### renamenx

`(renamenx key newkey)`

Rename a key, only if the new key does not exist. RENAMENX key newkey Available since: 1.0.0. Time complexity: O(1)

### replconf

`(replconf)`

An internal command for configuring the replication stream. REPLCONF Available since: 3.0.0. Time complexity: O(1)

### replicaof

`(replicaof host port)`

Make the server a replica of another instance, or promote it as master.. REPLICAOF host port Available since: 5.0.0. Time complexity: O(1)

### reset

`(reset)`

Reset the connection. RESET Available since: 6.2.0. Time complexity: O(1)

### restore

`(restore key ttl serialized-value)`

`(restore key ttl serialized-value & args)`

Create a key using the provided serialized value, previously obtained using DUMP.. RESTORE key ttl serialized-value [replace] [absttl] [seconds] [frequency] Available since: 2.6.0. Time 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)).

### restore-asking

`(restore-asking key ttl serialized-value)`

`(restore-asking key ttl serialized-value & args)`

An internal command for migrating keys in a cluster. RESTORE-ASKING key ttl serialized-value [replace] [absttl] [seconds] [frequency] Available since: 3.0.0. Time 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)).

### 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)`

Return the role of the instance in the context of replication. ROLE Available since: 2.8.12. Time complexity: O(1)

### rpop

`(rpop key)`

`(rpop key & args)`

Remove and get the last elements in a list. RPOP key [count] Available since: 1.0.0. Time complexity: O(N) where N is the number of elements returned

### rpoplpush

`(rpoplpush source destination)`

Remove the last element in a list, prepend it to another list and return it. RPOPLPUSH source destination Available since: 1.2.0. Time complexity: O(1)

### rpush

`(rpush key element)`

`(rpush key element & args)`

Append one or multiple elements to a list. RPUSH key element [element ...] Available since: 1.0.0. Time complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments.

### rpushx

`(rpushx key element)`

`(rpushx key element & args)`

Append an element to a list, only if the list exists. RPUSHX key element [element ...] Available since: 2.2.0. Time complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments.

### sadd

`(sadd key member)`

`(sadd key member & args)`

Add one or more members to a set. SADD key member [member ...] Available since: 1.0.0. Time complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments.

### save

`(save)`

Synchronously save the dataset to disk. SAVE Available since: 1.0.0. Time complexity: O(N) where N is the total number of keys in all databases

### scan

`(scan cursor)`

`(scan cursor & args)`

Incrementally iterate the keys space. SCAN cursor [pattern] [count] [type] Available since: 2.8.0. Time 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.

### scard

`(scard key)`

Get the number of members in a set. SCARD key Available since: 1.0.0. Time complexity: O(1)

### script

`(script)`

A container for Lua scripts management commands. SCRIPT Available since: 2.6.0. Time complexity: Depends on subcommand.

### script-debug

`(script-debug mode)`

Set the debug mode for executed scripts.. SCRIPT DEBUG mode Available since: 3.2.0. Time complexity: O(1)

### script-exists

`(script-exists sha1)`

`(script-exists sha1 & args)`

Check existence of scripts in the script cache.. SCRIPT EXISTS sha1 [sha1 ...] Available since: 2.6.0. Time complexity: O(N) with N being the number of scripts to check (so checking a single script is an O(1) operation).

### script-flush

`(script-flush)`

`(script-flush & args)`

Remove all the scripts from the script cache.. SCRIPT FLUSH [async] Available since: 2.6.0. Time complexity: O(N) with N being the number of scripts in cache

### script-hash

### script-help

`(script-help)`

Show helpful text about the different subcommands. SCRIPT HELP Available since: 5.0.0. Time complexity: O(1)

### script-kill

`(script-kill)`

Kill the script currently in execution.. SCRIPT KILL Available since: 2.6.0. Time complexity: O(1)

### script-load

`(script-load script)`

Load the specified Lua script into the script cache.. SCRIPT LOAD script Available since: 2.6.0. Time complexity: O(N) with N being the length in bytes of the script body.

### sdiff

`(sdiff key)`

`(sdiff key & args)`

Subtract multiple sets. SDIFF key [key ...] Available since: 1.0.0. Time complexity: O(N) where N is the total number of elements in all given sets.

### sdiffstore

`(sdiffstore destination key)`

`(sdiffstore destination key & args)`

Subtract multiple sets and store the resulting set in a key. SDIFFSTORE destination key [key ...] Available since: 1.0.0. Time complexity: O(N) where N is the total number of elements in all given sets.

### select

`(select index)`

Change the selected database for the current connection. SELECT index Available since: 1.0.0. Time complexity: O(1)

### serialize

DEPRECATED: Use `freeze` instead.

### set

`(set key value)`

`(set key value & args)`

Set the string value of a key. SET key value [condition] [get] [expiration] Available since: 1.0.0. Time complexity: O(1)

### setbit

`(setbit key offset value)`

Sets or clears the bit at offset in the string value stored at key. SETBIT key offset value Available since: 2.2.0. Time complexity: O(1)

### setex

`(setex key seconds value)`

Set the value and expiration of a key. SETEX key seconds value Available since: 2.0.0. Time complexity: O(1)

### setnx

`(setnx key value)`

Set the value of a key, only if the key does not exist. SETNX key value Available since: 1.0.0. Time complexity: O(1)

### setrange

`(setrange key offset value)`

Overwrite part of a string at key starting at the specified offset. SETRANGE key offset value Available since: 2.2.0. Time 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.

### shutdown

`(shutdown)`

`(shutdown & args)`

Synchronously save the dataset to disk and then shut down the server. SHUTDOWN [nosave_save] [now] [force] [abort] Available since: 1.0.0. Time complexity: O(N) when saving, where N is the total number of keys in all databases when saving data, otherwise O(1)

### sinter

`(sinter key)`

`(sinter key & args)`

Intersect multiple sets. SINTER key [key ...] Available since: 1.0.0. Time complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets.

### sintercard

`(sintercard numkeys key)`

`(sintercard numkeys key & args)`

Intersect multiple sets and return the cardinality of the result. SINTERCARD numkeys key [key ...] [limit] Available since: 7.0.0. Time complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets.

### sinterstore

`(sinterstore destination key)`

`(sinterstore destination key & args)`

Intersect multiple sets and store the resulting set in a key. SINTERSTORE destination key [key ...] Available since: 1.0.0. Time complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets.

### sismember

`(sismember key member)`

Determine if a given value is a member of a set. SISMEMBER key member Available since: 1.0.0. Time complexity: O(1)

### skip-replies

#### macro

DEPRECATED: Use `with-replies` instead.

### slaveof

`(slaveof host port)`

Make the server a replica of another instance, or promote it as master.. SLAVEOF host port Available since: 1.0.0. Time complexity: O(1)

### slowlog

`(slowlog)`

A container for slow log commands. SLOWLOG Available since: 2.2.12. Time complexity: Depends on subcommand.

### slowlog-get

`(slowlog-get)`

`(slowlog-get & args)`

Get the slow log's entries. SLOWLOG GET [count] Available since: 2.2.12. Time complexity: O(N) where N is the number of entries returned

### slowlog-help

`(slowlog-help)`

Show helpful text about the different subcommands. SLOWLOG HELP Available since: 6.2.0. Time complexity: O(1)

### slowlog-len

`(slowlog-len)`

Get the slow log's length. SLOWLOG LEN Available since: 2.2.12. Time complexity: O(1)

### slowlog-reset

`(slowlog-reset)`

Clear all entries from the slow log. SLOWLOG RESET Available since: 2.2.12. Time complexity: O(N) where N is the number of entries in the slowlog

### smembers

`(smembers key)`

Get all the members in a set. SMEMBERS key Available since: 1.0.0. Time complexity: O(N) where N is the set cardinality.

### smismember

`(smismember key member)`

`(smismember key member & args)`

Returns the membership associated with the given elements for a set. SMISMEMBER key member [member ...] Available since: 6.2.0. Time complexity: O(N) where N is the number of elements being checked for membership

### smove

`(smove source destination member)`

Move a member from one set to another. SMOVE source destination member Available since: 1.0.0. Time complexity: O(1)

### sort

`(sort key)`

`(sort key & args)`

Sort the elements in a list, set or sorted set. SORT key [pattern] [offset_count] [pattern [pattern ...]] [order] [sorting] [destination] Available since: 1.0.0. Time 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).

### 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 the elements in a list, set or sorted set. Read-only variant of SORT.. SORT_RO key [pattern] [offset_count] [pattern [pattern ...]] [order] [sorting] Available since: 7.0.0. Time 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).

### spop

`(spop key)`

`(spop key & args)`

Remove and return one or multiple random members from a set. SPOP key [count] Available since: 1.0.0. Time complexity: Without the count argument O(1), otherwise O(N) where N is the value of the passed count.

### spublish

`(spublish shardchannel message)`

Post a message to a shard channel. SPUBLISH shardchannel message Available since: 7.0.0. Time complexity: O(N) where N is the number of clients subscribed to the receiving shard channel.

### srandmember

`(srandmember key)`

`(srandmember key & args)`

Get one or multiple random members from a set. SRANDMEMBER key [count] Available since: 1.0.0. Time complexity: Without the count argument O(1), otherwise O(N) where N is the absolute value of the passed count.

### srem

`(srem key member)`

`(srem key member & args)`

Remove one or more members from a set. SREM key member [member ...] Available since: 1.0.0. Time complexity: O(N) where N is the number of members to be removed.

### sscan

`(sscan key cursor)`

`(sscan key cursor & args)`

Incrementally iterate Set elements. SSCAN key cursor [pattern] [count] Available since: 2.8.0. Time 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..

### ssubscribe

`(ssubscribe shardchannel)`

`(ssubscribe shardchannel & args)`

Listen for messages published to the given shard channels. SSUBSCRIBE shardchannel [shardchannel ...] Available since: 7.0.0. Time complexity: O(N) where N is the number of shard channels to subscribe to.

### strlen

`(strlen key)`

Get the length of the value stored in a key. STRLEN key Available since: 2.2.0. Time complexity: O(1)

### subscribe

`(subscribe channel)`

`(subscribe channel & args)`

Listen for messages published to the given channels. SUBSCRIBE channel [channel ...] Available since: 2.0.0. Time complexity: O(N) where N is the number of channels to subscribe to.

### substr

`(substr key start end)`

Get a substring of the string stored at a key. SUBSTR key start end Available since: 1.0.0. Time 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.

### sunion

`(sunion key)`

`(sunion key & args)`

Add multiple sets. SUNION key [key ...] Available since: 1.0.0. Time complexity: O(N) where N is the total number of elements in all given sets.

### sunionstore

`(sunionstore destination key)`

`(sunionstore destination key & args)`

Add multiple sets and store the resulting set in a key. SUNIONSTORE destination key [key ...] Available since: 1.0.0. Time complexity: O(N) where N is the total number of elements in all given sets.

### sunsubscribe

`(sunsubscribe)`

`(sunsubscribe & args)`

Stop listening for messages posted to the given shard channels. SUNSUBSCRIBE [shardchannel [shardchannel ...]] Available since: 7.0.0. Time complexity: O(N) where N is the number of clients already subscribed to a shard channel.

### swap

Experimental.

### swapdb

`(swapdb index1 index2)`

Swaps two Redis databases. SWAPDB index1 index2 Available since: 4.0.0. Time complexity: O(N) where N is the count of clients watching or blocking on keys from both databases.

### sync

`(sync)`

Internal command used for replication. SYNC Available since: 1.0.0.

### 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)`

Return the current server time. TIME Available since: 2.6.0. Time complexity: O(1)

### touch

`(touch key)`

`(touch key & args)`

Alters the last access time of a key(s). Returns the number of existing keys specified.. TOUCH key [key ...] Available since: 3.2.1. Time complexity: O(N) where N is the number of keys that will be touched.

### ttl

`(ttl key)`

Get the time to live for a key in seconds. TTL key Available since: 1.0.0. Time complexity: O(1)

### type

`(type key)`

Determine the type stored at key. TYPE key Available since: 1.0.0. Time complexity: O(1)

### unlink

`(unlink key)`

`(unlink key & args)`

Delete a key asynchronously in another thread. Otherwise it is just as DEL, but non blocking.. UNLINK key [key ...] Available since: 4.0.0. Time 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.

### unsubscribe

`(unsubscribe)`

`(unsubscribe & args)`

Stop listening for messages posted to the given channels. UNSUBSCRIBE [channel [channel ...]] Available since: 2.0.0. Time complexity: O(N) where N is the number of clients already subscribed to a channel.

### unwatch

`(unwatch)`

Forget about all watched keys. UNWATCH Available since: 2.2.0. Time complexity: O(1)

### wait

`(wait numreplicas timeout)`

Wait for the synchronous replication of all the write commands sent in the context of the current connection. WAIT numreplicas timeout Available since: 3.0.0. Time complexity: O(1)

### watch

`(watch key)`

`(watch key & args)`

Watch the given keys to determine execution of the MULTI/EXEC block. WATCH key [key ...] Available since: 2.2.0. Time complexity: O(1) for every key.

### 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://redistogo:pass@panga.redistogo.com:9475/"} - {: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

`(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. 0 [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` is: {<channel-or-pattern> (fn handler [msg])}. Example: (with-new-pubsub-listener {} ; Connection spec, as per `wcar` docstring [1] {"channel1" (fn [msg] (println "Channel match: " msg)) "user*" (fn [msg] (println "Pattern match: " msg))} (subscribe "foobar") ; Subscribe thread conn to "foobar" channel (psubscribe "foo*") ; Subscribe thread conn to "foo*" channel pattern ) 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: 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: Use `with-replies` instead.

### with-thaw-opts

#### macro

`(with-thaw-opts opts & body)`

### xack

`(xack key group id)`

`(xack key group id & args)`

Marks a pending message as correctly processed, effectively removing it from the pending entries list of the consumer group. Return value of the command is the number of messages successfully acknowledged, that is, the IDs we were actually able to resolve in the PEL.. XACK key group id [id ...] Available since: 5.0.0. Time complexity: O(1) for each message ID processed.

### xadd

`(xadd key)`

`(xadd key & args)`

Appends a new entry to a stream. XADD key [nomkstream] [trim] id_or_auto field_value [field_value ...] Available since: 5.0.0. Time complexity: O(1) when adding a new entry, O(N) when trimming where N being the number of entries evicted.

### xautoclaim

`(xautoclaim key group consumer min-idle-time start)`

`(xautoclaim key group consumer min-idle-time start & args)`

Changes (or acquires) ownership of messages in a consumer group, as if the messages were delivered to the specified consumer.. XAUTOCLAIM key group consumer min-idle-time start [count] [justid] Available since: 6.2.0. Time complexity: O(1) if COUNT is small.

### xclaim

`(xclaim key group consumer min-idle-time id)`

`(xclaim key group consumer min-idle-time id & args)`

Changes (or acquires) ownership of a message in a consumer group, as if the message was delivered to the specified consumer.. XCLAIM key group consumer min-idle-time id [id ...] [ms] [unix-time-milliseconds] [count] [force] [justid] [id] Available since: 5.0.0. Time complexity: O(log N) with N being the number of messages in the PEL of the consumer group.

### xdel

`(xdel key id)`

`(xdel key id & args)`

Removes the specified entries from the stream. Returns the number of items actually deleted, that may be different from the number of IDs passed in case certain IDs do not exist.. XDEL key id [id ...] Available since: 5.0.0. Time complexity: O(1) for each single item to delete in the stream, regardless of the stream size.

### xgroup

`(xgroup)`

A container for consumer groups commands. XGROUP Available since: 5.0.0. Time complexity: Depends on subcommand.

### xgroup-create

`(xgroup-create key groupname id)`

`(xgroup-create key groupname id & args)`

Create a consumer group.. XGROUP CREATE key groupname id [mkstream] [entries_read] Available since: 5.0.0. Time complexity: O(1)

### xgroup-createconsumer

`(xgroup-createconsumer key groupname consumername)`

Create a consumer in a consumer group.. XGROUP CREATECONSUMER key groupname consumername Available since: 6.2.0. Time complexity: O(1)

### xgroup-delconsumer

`(xgroup-delconsumer key groupname consumername)`

Delete a consumer from a consumer group.. XGROUP DELCONSUMER key groupname consumername Available since: 5.0.0. Time complexity: O(1)

### xgroup-destroy

`(xgroup-destroy key groupname)`

Destroy a consumer group.. XGROUP DESTROY key groupname Available since: 5.0.0. Time complexity: O(N) where N is the number of entries in the group's pending entries list (PEL).

### xgroup-help

`(xgroup-help)`

Show helpful text about the different subcommands. XGROUP HELP Available since: 5.0.0. Time complexity: O(1)

### xgroup-setid

`(xgroup-setid key groupname id)`

`(xgroup-setid key groupname id & args)`

Set a consumer group to an arbitrary last delivered ID value.. XGROUP SETID key groupname id [entries_read] Available since: 5.0.0. Time complexity: O(1)

### xinfo

`(xinfo)`

A container for stream introspection commands. XINFO Available since: 5.0.0. Time complexity: Depends on subcommand.

### xinfo-consumers

`(xinfo-consumers key groupname)`

List the consumers in a consumer group. XINFO CONSUMERS key groupname Available since: 5.0.0. Time complexity: O(1)

### xinfo-groups

`(xinfo-groups key)`

List the consumer groups of a stream. XINFO GROUPS key Available since: 5.0.0. Time complexity: O(1)

### xinfo-help

`(xinfo-help)`

Show helpful text about the different subcommands. XINFO HELP Available since: 5.0.0. Time complexity: O(1)

### xinfo-stream

`(xinfo-stream key)`

`(xinfo-stream key & args)`

Get information about a stream. XINFO STREAM key [full] Available since: 5.0.0. Time complexity: O(1)

### xlen

`(xlen key)`

Return the number of entries in a stream. XLEN key Available since: 5.0.0. Time complexity: O(1)

### xpending

`(xpending key group)`

`(xpending key group & args)`

Return information and entries from a stream consumer group pending entries list, that are messages fetched but never acknowledged.. XPENDING key group [filters] Available since: 5.0.0. Time 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.

### xrange

`(xrange key start end)`

`(xrange key start end & args)`

Return a range of elements in a stream, with IDs matching the specified IDs interval. XRANGE key start end [count] Available since: 5.0.0. Time 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).

### xread

`(xread)`

`(xread & args)`

Return never seen elements in multiple streams, with IDs greater than the ones reported by the caller for each stream. Can block.. XREAD [count] [milliseconds] streams Available since: 5.0.0. Time complexity: For each stream mentioned: O(N) with N being the number of elements being returned, it means that XREAD-ing with a fixed COUNT is O(1). Note that when the BLOCK option is used, XADD will pay O(M) time in order to serve the M clients blocked on the stream getting new data.

### xreadgroup

`(xreadgroup group_consumer)`

`(xreadgroup group_consumer & args)`

Return new entries from a stream using a consumer group, or access the history of the pending entries for a given consumer. Can block.. XREADGROUP group_consumer [count] [milliseconds] [noack] streams Available since: 5.0.0. Time 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.

### xrevrange

`(xrevrange key end start)`

`(xrevrange key end start & args)`

Return a range of elements in a stream, with IDs matching the specified IDs interval, in reverse order (from greater to smaller IDs) compared to XRANGE. XREVRANGE key end start [count] Available since: 5.0.0. Time 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).

### xsetid

`(xsetid key last-id)`

`(xsetid key last-id & args)`

An internal command for replicating stream values. XSETID key last-id [entries_added] [max_deleted_entry_id] Available since: 5.0.0. Time complexity: O(1)

### xtrim

`(xtrim key trim)`

Trims the stream to (approximately if '~' is passed) a certain size. XTRIM key trim Available since: 5.0.0. Time 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.

### zadd

`(zadd key)`

`(zadd key & args)`

Add one or more members to a sorted set, or update its score if it already exists. ZADD key [condition] [comparison] [change] [increment] score_member [score_member ...] Available since: 1.2.0. Time complexity: O(log(N)) for each item added, where N is the number of elements in the sorted set.

### zcard

`(zcard key)`

Get the number of members in a sorted set. ZCARD key Available since: 1.2.0. Time complexity: O(1)

### zcount

`(zcount key min max)`

Count the members in a sorted set with scores within the given values. ZCOUNT key min max Available since: 2.0.0. Time complexity: O(log(N)) with N being the number of elements in the sorted set.

### zdiff

`(zdiff numkeys key)`

`(zdiff numkeys key & args)`

Subtract multiple sorted sets. ZDIFF numkeys key [key ...] [withscores] Available since: 6.2.0. Time 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.

### zdiffstore

`(zdiffstore destination numkeys key)`

`(zdiffstore destination numkeys key & args)`

Subtract multiple sorted sets and store the resulting sorted set in a new key. ZDIFFSTORE destination numkeys key [key ...] Available since: 6.2.0. Time 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.

### zincrby

`(zincrby key increment member)`

Increment the score of a member in a sorted set. ZINCRBY key increment member Available since: 1.2.0. Time complexity: O(log(N)) where N is the number of elements in the sorted set.

### zinter

`(zinter numkeys key)`

`(zinter numkeys key & args)`

Intersect multiple sorted sets. ZINTER numkeys key [key ...] [weight [weight ...]] [aggregate] [withscores] Available since: 6.2.0. Time 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.

### zintercard

`(zintercard numkeys key)`

`(zintercard numkeys key & args)`

Intersect multiple sorted sets and return the cardinality of the result. ZINTERCARD numkeys key [key ...] [limit] Available since: 7.0.0. Time complexity: O(N*K) worst case with N being the smallest input sorted set, K being the number of input sorted sets.

### zinterstore

`(zinterstore destination numkeys key)`

`(zinterstore destination numkeys key & args)`

Intersect multiple sorted sets and store the resulting sorted set in a new key. ZINTERSTORE destination numkeys key [key ...] [weight [weight ...]] [aggregate] Available since: 2.0.0. Time 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.

### zinterstore*

`(zinterstore* dest-key source-keys & opts)`

Like `zinterstore` but automatically counts keys.

### zlexcount

`(zlexcount key min max)`

Count the number of members in a sorted set between a given lexicographical range. ZLEXCOUNT key min max Available since: 2.8.9. Time complexity: O(log(N)) with N being the number of elements in the sorted set.

### zmpop

`(zmpop numkeys key)`

`(zmpop numkeys key & args)`

Remove and return members with scores in a sorted set. ZMPOP numkeys key [key ...] where [count] Available since: 7.0.0. Time 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.

### zmscore

`(zmscore key member)`

`(zmscore key member & args)`

Get the score associated with the given members in a sorted set. ZMSCORE key member [member ...] Available since: 6.2.0. Time complexity: O(N) where N is the number of members being requested.

### zpopmax

`(zpopmax key)`

`(zpopmax key & args)`

Remove and return members with the highest scores in a sorted set. ZPOPMAX key [count] Available since: 5.0.0. Time complexity: O(log(N)*M) with N being the number of elements in the sorted set, and M being the number of elements popped.

### zpopmin

`(zpopmin key)`

`(zpopmin key & args)`

Remove and return members with the lowest scores in a sorted set. ZPOPMIN key [count] Available since: 5.0.0. Time complexity: O(log(N)*M) with N being the number of elements in the sorted set, and M being the number of elements popped.

### zrandmember

`(zrandmember key)`

`(zrandmember key & args)`

Get one or multiple random elements from a sorted set. ZRANDMEMBER key [options] Available since: 6.2.0. Time complexity: O(N) where N is the number of elements returned

### zrange

`(zrange key start stop)`

`(zrange key start stop & args)`

Return a range of members in a sorted set. ZRANGE key start stop [sortby] [rev] [offset_count] [withscores] Available since: 1.2.0. Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements returned.

### zrangebylex

`(zrangebylex key min max)`

`(zrangebylex key min max & args)`

Return a range of members in a sorted set, by lexicographical range. ZRANGEBYLEX key min max [offset_count] Available since: 2.8.9. Time 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)).

### zrangebyscore

`(zrangebyscore key min max)`

`(zrangebyscore key min max & args)`

Return a range of members in a sorted set, by score. ZRANGEBYSCORE key min max [withscores] [offset_count] Available since: 1.0.5. Time 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)).

### zrangestore

`(zrangestore dst src min max)`

`(zrangestore dst src min max & args)`

Store a range of members from sorted set into another key. ZRANGESTORE dst src min max [sortby] [rev] [offset_count] Available since: 6.2.0. Time 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.

### zrank

`(zrank key member)`

Determine the index of a member in a sorted set. ZRANK key member Available since: 2.0.0. Time complexity: O(log(N))

### zrem

`(zrem key member)`

`(zrem key member & args)`

Remove one or more members from a sorted set. ZREM key member [member ...] Available since: 1.2.0. Time 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.

### zremrangebylex

`(zremrangebylex key min max)`

Remove all members in a sorted set between the given lexicographical range. ZREMRANGEBYLEX key min max Available since: 2.8.9. Time 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.

### zremrangebyrank

`(zremrangebyrank key start stop)`

Remove all members in a sorted set within the given indexes. ZREMRANGEBYRANK key start stop Available since: 2.0.0. Time 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.

### zremrangebyscore

`(zremrangebyscore key min max)`

Remove all members in a sorted set within the given scores. ZREMRANGEBYSCORE key min max Available since: 1.2.0. Time 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.

### zrevrange

`(zrevrange key start stop)`

`(zrevrange key start stop & args)`

Return a range of members in a sorted set, by index, with scores ordered from high to low. ZREVRANGE key start stop [withscores] Available since: 1.2.0. Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements returned.

### zrevrangebylex

`(zrevrangebylex key max min)`

`(zrevrangebylex key max min & args)`

Return a range of members in a sorted set, by lexicographical range, ordered from higher to lower strings.. ZREVRANGEBYLEX key max min [offset_count] Available since: 2.8.9. Time 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)).

### zrevrangebyscore

`(zrevrangebyscore key max min)`

`(zrevrangebyscore key max min & args)`

Return a range of members in a sorted set, by score, with scores ordered from high to low. ZREVRANGEBYSCORE key max min [withscores] [offset_count] Available since: 2.2.0. Time 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)).

### zrevrank

`(zrevrank key member)`

Determine the index of a member in a sorted set, with scores ordered from high to low. ZREVRANK key member Available since: 2.0.0. Time complexity: O(log(N))

### zscan

`(zscan key cursor)`

`(zscan key cursor & args)`

Incrementally iterate sorted sets elements and associated scores. ZSCAN key cursor [pattern] [count] Available since: 2.8.0. Time 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..

### zscore

`(zscore key member)`

Get the score associated with the given member in a sorted set. ZSCORE key member Available since: 1.2.0. Time complexity: O(1)

### zunion

`(zunion numkeys key)`

`(zunion numkeys key & args)`

Add multiple sorted sets. ZUNION numkeys key [key ...] [weight [weight ...]] [aggregate] [withscores] Available since: 6.2.0. Time 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.

### zunionstore

`(zunionstore destination numkeys key)`

`(zunionstore destination numkeys key & args)`

Add multiple sorted sets and store the resulting sorted set in a new key. ZUNIONSTORE destination numkeys key [key ...] [weight [weight ...]] [aggregate] Available since: 2.0.0. Time 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.

### zunionstore*

`(zunionstore* dest-key source-keys & opts)`

Like `zunionstore` but automatically counts keys.