kevy
命令参考

命令参考

引擎能回答的每一条动词 —— 共 206 条,与服务端分发所用的是同一张表。

connection

ECHOReturn the given message.
HELLOHandshake: report server info and switch RESP protocol version (2 or 3).
PINGPing the server; returns PONG or echoes the optional message.
QUITClose the connection after replying OK.
SELECTSelect the logical database; kevy is single-DB and only accepts index 0.

feed

FEED.READRead change-feed frames from one shard past a generation/offset cursor.
FEED.SHARDSReturn the number of change-feed shards.
FEED.TAILReturn a shard's current feed generation and next offset.

generic

COPYCopy a key's value, and its remaining TTL, to another key.
DELDelete one or more keys.
EXISTSCount how many of the given keys exist.
EXPIRESet a key's TTL in seconds (non-positive TTL deletes the key).
EXPIREATSet a key's expiry as an absolute Unix timestamp in seconds.
PERSISTRemove a key's TTL.
PEXPIRESet a key's TTL in milliseconds.
PEXPIREATSet a key's expiry as an absolute Unix timestamp in milliseconds.
PTTLReturn a key's remaining TTL in milliseconds (-1 no TTL, -2 missing).
RENAMERename a key, overwriting the destination (write routed at the runtime Op level).
RENAMENXRename a key only if the destination does not exist (write routed at the runtime Op level).
TOUCHCount how many of the given keys exist.
TTLReturn a key's remaining TTL in seconds (-1 no TTL, -2 missing).
TYPEReturn the type of the value stored at key.
UNLINKDelete one or more keys (alias of DEL in kevy's shard model).

geo

GEOADDAdd geospatial members (longitude/latitude) to a geo set.
GEODISTReturn the distance between two geo members.
GEOHASHReturn the base32 geohash string of each member.
GEOPOSReturn the longitude/latitude of each member.
GEORADIUSLegacy radius search around a coordinate, with optional STORE writes.
GEORADIUSBYMEMBERLegacy radius search around an existing member, with optional STORE writes.
GEOSEARCHSearch members within a radius or box from a member or coordinate.
GEOSEARCHSTORERun GEOSEARCH on source and store the hits into destination.

hash

HDELDelete one or more hash fields.
HEXISTSCheck whether a hash field exists.
HEXPIRESet per-field TTLs on a hash, in seconds.
HGETReturn the value of a hash field.
HGETALLReturn all fields and values of a hash.
HINCRBYIncrement the integer value of a hash field.
HINCRBYFLOATIncrement the float value of a hash field.
HKEYSReturn all field names of a hash.
HLENReturn the number of fields in a hash.
HMGETReturn the values of multiple hash fields.
HMSETDeprecated alias of HSET that replies OK.
HPERSISTRemove per-field TTLs from a hash.
HPEXPIRESet per-field TTLs on a hash, in milliseconds.
HPEXPIREATSet per-field expiries as absolute Unix-millisecond deadlines.
HPTTLReturn per-field remaining TTLs in milliseconds (-1 no TTL, -2 missing).
HRANDFIELDReturn random fields from a hash; a negative count allows repeats, WITHVALUES pairs each with its value.
HSCANIterate a hash's fields and values (single-batch cursor).
HSETSet one or more hash fields; returns the number of new fields.
HSETNXSet a hash field only if it does not exist.
HTTLReturn per-field remaining TTLs in seconds (-1 no TTL, -2 missing).
HVALSReturn all values of a hash.

index

IDX.ADVISEThe declarations refused queries have been asking for, most-refused first — each rendered as the command that would serve it.
IDX.COUNTCount index entries matching a range or equality predicate.
IDX.CREATEDeclare a secondary index over a key prefix (catalog mutation, sidecar-persisted).
IDX.DROPDrop a declared index (catalog mutation, sidecar-persisted).
IDX.EXPLAINThe IDX.QUERY parse without the execution: kind, state, est_rows, and the plan line.
IDX.LISTList declared indexes with per-index build state and stats.
IDX.QUERYQuery an index: range/equality, text MATCH, vector KNN, aggregation groups, or a two-index COMPOSE.
IDX.REBUILDRebuild an ANN index (tombstone compaction).
IDX.VERIFYVerify an index. Scalar kinds re-read every held entry against its row and report entries/bytes/coerce_failures/duplicates/drift/checked/missing (both audit directions); agg/text/ann answer their own sizing vocabulary (rows|docs|vectors, bytes, ...) and carry no row-keyed audit.

list

BLPOPBlocking left pop across one or more lists (effect logged as LPOP).
BRPOPBlocking right pop across one or more lists (effect logged as RPOP).
BRPOPLPUSHBlocking RPOPLPUSH: pop the source tail and push it onto the destination head.
LINDEXReturn the element at the given list index.
LINSERTInsert an element before or after a pivot element.
LLENReturn the length of a list.
LMOVEAtomically move an element between two lists.
LPOPPop one or more elements from the head of a list.
LPOSReturn the index of matching elements in a list.
LPUSHPrepend one or more elements to a list.
LRANGEReturn a range of list elements.
LREMRemove elements equal to the given value from a list.
LSETSet the list element at the given index.
LTRIMTrim a list to the given range.
RPOPPop one or more elements from the tail of a list.
RPOPLPUSHPop the source tail and push it onto the destination head.
RPUSHAppend one or more elements to a list.

migration

PREFIX.DIGESTOrder-insensitive checksum of a prefix's rows for migration verification.
PREFIX.STATSReport key-count and byte statistics for a key prefix.

pubsub

PSUBSCRIBESubscribe to channels matching the given glob patterns.
PUBLISHPost a message to a channel; returns the receiver count.
PUNSUBSCRIBEUnsubscribe from patterns (all patterns when none given).
SUBSCRIBESubscribe to the given channels.
UNSUBSCRIBEUnsubscribe from channels (all channels when none given).

replication

FAILOVERPlanned zero-loss handover: quiesce writes, wait for the target replica to drain, promote it, and follow it.
REPL.TOKENkevy extension: mint a read-your-writes token — per-shard [generation, offset] pairs (a primary reports its live feed tail; a replica its applied positions).
REPL.WAITkevy extension: on a replica, block until every shard has applied the given REPL.TOKEN (then reads are read-your-writes); +OK on success, -MISDIRECTED writer is <primary> on timeout or generation mismatch. Default TIMEOUT 1000 ms, hard cap 60 s. On a primary: immediate +OK.
REPLICAOFMake this server a replica of another, or promote it with NO ONE.
ROLEReport the replication role and state of this server.
SLAVEOFLegacy alias of REPLICAOF.
WAITBlock until every shard's master_repl_offset is acknowledged by at least numreplicas replicas (or timeout ms pass); returns the minimum acked-replica count across shards. timeout 0 = wait forever, hard-capped at 60 s. NOTE: a replica ACK is not fsync durability.

scan

KEYSReturn every key matching the glob pattern (cross-shard gather).
RANDOMKEYReturn a random key from the keyspace.
SCANIterate the keyspace incrementally: each call walks ~COUNT buckets of one shard and returns the next cursor.

script

EVALRun a Lua script server-side; routed to KEYS[1]'s shard when numkeys >= 1.
EVALSHARun a cached Lua script by its SHA1 digest.
SCRIPTManage the process-wide Lua script cache.

server

BGREWRITEAOFStart an append-only-file rewrite in the background.
BGSAVEStart a snapshot save in the background.
CLIENTConnection introspection and control subcommands.
CLUSTERCluster topology introspection (virtual-node model over shards).
COMMANDIntrospect the command table (COUNT, LIST, INFO, DOCS subcommands).
CONFIGRead or change server configuration parameters.
DBSIZEReturn the number of keys across all shards.
DEBUGDebug subcommands; SLEEP blocks the shard, other subcommands are tolerated as OK.
FLUSHALLDelete every key on every shard.
FLUSHDBDelete every key of the current database (kevy is single-DB: same as FLUSHALL).
INFOReport server statistics and status sections as text.
MEMORYMemory introspection subcommands.
SAVESynchronously snapshot the dataset to disk.
SHUTDOWNStop the server process (connection drops without a reply).
SLOWLOGInspect or reset the slow-command log.
TIMEReturn the server clock as unix seconds and microseconds.

set

SADDAdd one or more members to a set.
SCARDReturn the number of members in a set.
SDIFFReturn the difference of the given sets (cross-shard gather).
SDIFFSTOREStore the difference of the given sets into destination.
SINTERReturn the intersection of the given sets (cross-shard gather).
SINTERSTOREStore the intersection of the given sets into destination.
SISMEMBERCheck whether a value is a member of a set.
SMEMBERSReturn all members of a set.
SPOPRemove and return one or more random members of a set.
SRANDMEMBERReturn one or more random members of a set without removing them. A negative count allows repeats.
SREMRemove one or more members from a set.
SSCANIterate a set's members (single-batch cursor).
SUNIONReturn the union of the given sets (cross-shard gather).
SUNIONSTOREStore the union of the given sets into destination.

stream

XACKAcknowledge pending entries for a consumer group.
XADDAppend an entry to a stream, with optional trim.
XAUTOCLAIMScan and claim idle pending entries starting from a cursor.
XCLAIMClaim specific idle pending entries for a consumer.
XDELDelete entries from a stream by ID.
XGROUPManage stream consumer groups.
XINFOIntrospect a stream, its groups, or its consumers.
XLENReturn the number of entries in a stream.
XPENDINGInspect pending entries of a consumer group (summary or extended form).
XRANGEReturn stream entries within an ID range.
XREADRead new entries from one or more streams, optionally blocking.
XREADGROUPRead stream entries as a consumer-group member, optionally blocking.
XREVRANGEReturn stream entries within an ID range, in reverse order.
XSETIDOverwrite a stream's last-generated ID and bookkeeping counters.
XTRIMTrim a stream by length or minimum ID.

string

APPENDAppend bytes to a string value; returns the new length.
BITCOUNTCount set bits in a string, optionally over a byte range.
BITOPCombine strings bitwise into a destination key.
BITPOSReturn the position of the first bit set to 0 or 1.
DECRDecrement the integer value of a key by one.
DECRBYDecrement the integer value of a key by the given amount.
GETReturn the string value of a key.
GETBITReturn the bit at the given offset of a string.
GETDELReturn the string value of a key and delete it.
GETEXRead a key and set its expiry in the same call.
GETRANGEReturn a byte range of a string value.
GETSETSet a key's string value and return its previous value.
INCRIncrement the integer value of a key by one.
INCRBYIncrement the integer value of a key by the given amount.
INCRBYFLOATIncrement the float value of a key by the given amount.
MGETReturn the values of multiple keys (cross-shard gather).
MSETSet multiple key/value pairs atomically per shard.
PSETEXSet a key's value with a TTL in milliseconds.
SETSet a key's string value with optional TTL and existence conditions.
SETBITSet the bit at the given offset, returning its old value.
SETEXSet a key's value with a TTL in seconds.
SETNXSet a key's value only if it does not exist.
SETRANGEOverwrite a string from the given offset, returning the new length.
STRLENReturn the length of a key's string value.

table

TABLE.DECLAREDeclare a relational table that compiles at declare time into named indexes (catalog mutation, sidecar-persisted).
TABLE.DROPDrop a declared table and its compiled indexes (catalog mutation, sidecar-persisted).
TABLE.ENSURETABLE.DECLARE's boot form: identical existing declaration answers +UNCHANGED, a different one is a named refusal saying which part differs — never a silent rebuild.
TABLE.LISTList declared tables with their prefix, PK and declaration counts.
TABLE.REPLACEDrop and redeclare in one verb, rebuilding every compiled index from the rows. Named for its cost: a full backfill, asked for explicitly. A bad spec refuses BEFORE the old table drops.
TABLE.VERIFYVerify a table: each compiled index's full drift recheck plus a bounded column-type spot check over sampled rows.

tx

DISCARDAbort the open MULTI transaction.
EXECExecute every command queued since MULTI.
MULTIStart a transaction; subsequent commands are queued until EXEC.
UNWATCHForget all watched keys.
WATCHWatch keys for optimistic locking of the next EXEC.

view

VIEW.CREATEDeclare a composed view over indexes with an ORDER BY (catalog mutation, sidecar-persisted).
VIEW.DROPDrop a declared view (catalog mutation, sidecar-persisted).
VIEW.EXPLAINExplain a view's composition tree with per-leaf cardinalities.
VIEW.LISTList declared views with their mode and shape.
VIEW.QUERYPage through a view's ordered members, optionally hydrating fields via the VIA template.
VIEW.REBUILDForce a rebuild of a materialized view.
VIEW.VERIFYVerify a view and report member/byte statistics.

zset

BZPOPMINBlocking pop of the lowest-scored member across one or more sorted sets.
ZADDAdd members with scores to a sorted set, with conditional flags.
ZCARDReturn the number of members in a sorted set.
ZCOUNTCount members with scores within the given bounds.
ZDIFFSTOREStore the difference of the given sorted sets into destination.
ZINCRBYIncrement a member's score in a sorted set.
ZINTERCARDReturn the cardinality of the intersection of the given sorted sets.
ZINTERSTOREStore the intersection of the given sorted sets into destination.
ZPOPMINPop up to count members with the lowest scores.
ZPOPMIN.BELOWkevy extension: pop up to count lowest members with score strictly below the threshold (delayed-job primitive).
ZRANGEReturn members by rank range.
ZRANGEBYSCOREReturn members with scores within the given bounds.
ZRANKReturn a member's rank, ordered from the lowest score.
ZREMRemove one or more members from a sorted set.
ZREMRANGEBYRANKRemove members within the given rank range.
ZREMRANGEBYSCORERemove members with scores within the given bounds.
ZREVRANGEReturn members by rank range, highest score first.
ZREVRANGEBYSCOREReturn members with scores within the given bounds, highest first.
ZSCANIterate a sorted set's members and scores (single-batch cursor).
ZSCOREReturn a member's score.
ZUNIONSTOREStore the union of the given sorted sets into destination.