Skip to content

Use cases: sending commands

Bjorn Svensson edited this page Jan 29, 2021 · 14 revisions

Send a single key command

A command that should be handled by a single node, owning the slot that represent the key.

Examples:

SET key val
GET key
EVAL script numkeys key [key ...] arg [arg ...]

Send a multi key command

Command that contain multiple keys that might be handled by multiple nodes. The responses from nodes could be different.

Examples:

MSET key value [key value ...]
DEL key [key ...]
EXISTS key [key ...]

Command that contain multiple keys but should not be handled by multiple nodes.

Examples:

EVAL script numkeys key [key ...] arg [arg ...]
MSETNX key value [key value ...]

Send a command to all nodes

Examples:

SCRIPT LOAD script
DBSIZE

Send a command without key to a specific single node

Optimistic locking

Examples:

SCAN cursor [MATCH pattern] [COUNT count] [TYPE type]
MULTI
EXEC

Send a command without key to any single node

Examples:

PUBLISH channel message           (?, or all, or any, or given)
SUBSCRIBE channel [channel ...]   (?, or all, or any, or given)

Send a command to all master nodes (needed?)

Send a command to all replica nodes (needed?)

Examples:

READONLY  (far-fetched..)