-
Notifications
You must be signed in to change notification settings - Fork 0
CREATE
Young Yu edited this page May 26, 2024
·
6 revisions
Creates a new stash. Fails if the stash name is already taken, or if the stash name is too long. A stash's name is limited to 64 bytes in length (so 64 characters). Returns OK
if successful.
create <name> [-off-heap <true/false>] [-max-keys <max_keys>] [-snapshots <true/false>]
-
name
: The name of the stash to create. Required. -
-off-heap
: Whether to store values off-heap. Defaults totrue
. Optional. -
-max-keys
: The max number of keys allowed in the stash before eviction occurs. The max allowed value is theLong.MAX_VALUE
or2^32-1
. Defaults to1,000,000
. Optional. -
-snapshots
: Whether to take periodic snapshots to disk. Defaults tofalse
. Optional.
In this example, we create a stash named "people".
> create people
OK
In this example, we create a stash named "pizzas" with snapshots enabled, storing values off-heap, and with a limit of 100 keys before eviction kicks in.
> create pizzas -snapshots true -off-heap false -max-keys 100
OK
For how to send commands directly through the TCP connection, see the protocol section.
CREATE <name> <num_opt_args> [OFF_HEAP=<true/false>] [MAX_KEYS=<max_keys>] [SNAPSHOTS=<true/false>]
-
name
: The name of the stash to create. Required. -
num_opt_args
: The number of optional arguments specified. Required. -
OFF_HEAP
: Whether to store values off-heap. Defaults totrue
. Optional. -
MAX_KEYS
: The max number of keys allowed in the stash before eviction occurs. The max allowed value is theLong.MAX_VALUE
or2^32-1
Defaults to1,000,000
. Optional. -
SNAPSHOTS
: Whether to take periodic snapshots to disk. Defaults tofalse
. Optional.
CREATE pizzas 0
would be encoded as:
6\r\nCREATE6\r\npizzas1\r\n0
CREATE pizzas 1 OFF_HEAP=false
would be encoded as:
6\r\nCREATE6\r\npizzas1\r\n114\r\nOFF_HEAP=false