Lux Docs

Build on Lux without guessing.

Lux Cloud + OSS core

Product docs for the Lux runtime: tables, cache, vectors, realtime, time series, auth, HTTP, SDK, CLI, and self-hosting.

Command Reference

The full low-level reference for Lux. Use this page when you want raw command access across cache, tables, vectors, queues, realtime, and time series.

If you are building an application on Lux Cloud, most teams start with Tables, the SDK, and Realtime. Drop down to raw commands when you want direct control or full Redis client compatibility.

Strings

CommandDescription
SETSet a key to a string value
GETGet the value of a key
SETNXSet a key only if it does not exist
SETEXSet a key with an expiration in seconds
PSETEXSet a key with an expiration in milliseconds
GETSETSet a key and return its old value
GETDELGet the value and delete the key
GETEXGet the value and optionally set expiration
GETRANGEGet a substring of the string value
SETRANGEOverwrite part of a string at the specified offset
MGETGet values of multiple keys
MSETSet multiple keys to multiple values
MSETNXSet multiple keys only if none exist
STRLENGet the length of a string value
APPENDAppend a value to a key
INCRIncrement the integer value by one
DECRDecrement the integer value by one
INCRBYIncrement the integer value by a given amount
DECRBYDecrement the integer value by a given amount
INCRBYFLOATIncrement the float value by a given amount
SETBITSet or clear the bit at offset in the string value
GETBITGet the bit value at offset in the string value
BITCOUNTCount set bits in a string
BITPOSFind the first bit set or clear in a string
BITOPPerform bitwise operations between strings

Keys

CommandDescription
DELDelete one or more keys
UNLINKDelete keys asynchronously
EXISTSCheck if one or more keys exist
KEYSFind all keys matching a pattern
SCANIncrementally iterate keys
TYPEGet the type of a key
RENAMERename a key
RENAMENXRename a key only if the new name does not exist
RANDOMKEYReturn a random key from the database
COPYCopy a key to another key
TTLGet the time to live in seconds
PTTLGet the time to live in milliseconds
EXPIRESet a timeout on a key in seconds
PEXPIRESet a timeout on a key in milliseconds
EXPIREATSet expiration as a Unix timestamp in seconds
PEXPIREATSet expiration as a Unix timestamp in milliseconds
EXPIRETIMEGet the expiration as a Unix timestamp in seconds
PEXPIRETIMEGet the expiration as a Unix timestamp in milliseconds
PERSISTRemove the expiration from a key
DBSIZEReturn the number of keys in the database
FLUSHDBRemove all keys from the current database
FLUSHALLRemove all keys from all databases

Lists

CommandDescription
LPUSHPrepend one or more values to a list
RPUSHAppend one or more values to a list
LPUSHXPrepend a value only if the list exists
RPUSHXAppend a value only if the list exists
LPOPRemove and return the first element
RPOPRemove and return the last element
BLPOPRemove and return the first element, blocking if empty
BRPOPRemove and return the last element, blocking if empty
BLMOVEPop from one list and push to another, blocking if empty
LLENGet the length of a list
LRANGEGet a range of elements from a list
LINDEXGet an element by its index
LSETSet the value of an element by its index
LINSERTInsert an element before or after another element
LREMRemove elements from a list
LTRIMTrim a list to the specified range
LPOSGet the index of matching elements
LMOVEPop from one list and push to another
RPOPLPUSHPop from the tail of one list and push to the head of another

Hashes

CommandDescription
HSETSet one or more hash fields
HSETNXSet a hash field only if it does not exist
HMSETSet multiple hash fields
HGETGet the value of a hash field
HMGETGet values of multiple hash fields
HDELDelete one or more hash fields
HGETALLGet all fields and values in a hash
HKEYSGet all field names in a hash
HVALSGet all values in a hash
HLENGet the number of fields in a hash
HEXISTSCheck if a hash field exists
HINCRBYIncrement the integer value of a hash field
HINCRBYFLOATIncrement the float value of a hash field
HSTRLENGet the length of a hash field value
HRANDFIELDGet one or more random fields from a hash
HSCANIncrementally iterate hash fields and values

Sets

CommandDescription
SADDAdd one or more members to a set
SREMRemove one or more members from a set
SMEMBERSGet all members of a set
SISMEMBERCheck if a value is a member of a set
SMISMEMBERCheck membership for multiple values
SCARDGet the number of members in a set
SPOPRemove and return a random member
SRANDMEMBERGet one or more random members
SMOVEMove a member from one set to another
SUNIONReturn the union of multiple sets
SINTERReturn the intersection of multiple sets
SDIFFReturn the difference of multiple sets
SUNIONSTOREStore the union of multiple sets
SINTERSTOREStore the intersection of multiple sets
SDIFFSTOREStore the difference of multiple sets
SINTERCARDReturn the cardinality of the intersection
SSCANIncrementally iterate set members

Sorted Sets

CommandDescription
ZADDAdd one or more members with scores
ZSCOREGet the score of a member
ZMSCOREGet scores of multiple members
ZRANKGet the rank of a member (ascending)
ZREVRANKGet the rank of a member (descending)
ZREMRemove one or more members
ZCARDGet the number of members
ZCOUNTCount members in a score range
ZLEXCOUNTCount members in a lexicographic range
ZINCRBYIncrement the score of a member
ZRANGEReturn members in a range by index
ZREVRANGEReturn members in a range by index (descending)
ZRANGEBYSCOREReturn members in a score range
ZREVRANGEBYSCOREReturn members in a score range (descending)
ZRANGEBYLEXReturn members in a lexicographic range
ZREVRANGEBYLEXReturn members in a lexicographic range (descending)
ZPOPMINRemove and return members with the lowest scores
ZPOPMAXRemove and return members with the highest scores
BZPOPMINRemove and return the member with the lowest score, blocking if empty
BZPOPMAXRemove and return the member with the highest score, blocking if empty
ZUNIONSTOREStore the union of multiple sorted sets
ZINTERSTOREStore the intersection of multiple sorted sets
ZDIFFSTOREStore the difference of multiple sorted sets
ZREMRANGEBYRANKRemove members in a rank range
ZREMRANGEBYSCORERemove members in a score range
ZREMRANGEBYLEXRemove members in a lexicographic range
ZSCANIncrementally iterate sorted set members and scores

Geo

CommandDescription
GEOADDAdd geospatial items (longitude, latitude, name)
GEODISTGet the distance between two members
GEOPOSGet the longitude and latitude of members
GEOHASHGet the geohash string of members
GEOSEARCHSearch for members within a geographic area
GEOSEARCHSTORESearch and store results in a new key
GEORADIUSQuery members within a radius (deprecated, use GEOSEARCH)
GEORADIUSBYMEMBERQuery members within a radius of a member (deprecated)
GEORADIUS_RORead-only variant of GEORADIUS
GEORADIUSBYMEMBER_RORead-only variant of GEORADIUSBYMEMBER

Streams

CommandDescription
XADDAppend an entry to a stream
XLENGet the number of entries in a stream
XRANGEReturn a range of entries
XREVRANGEReturn a range of entries in reverse order
XREADRead entries from one or more streams
XREADGROUPRead entries using a consumer group
XGROUP CREATECreate a consumer group
XGROUP DESTROYDestroy a consumer group
XACKAcknowledge one or more pending entries
XPENDINGGet information about pending entries
XCLAIMClaim ownership of pending entries
XAUTOCLAIMAutomatically claim idle pending entries
XDELDelete entries from a stream
XTRIMTrim the stream to a maximum length
XINFO STREAMGet information about a stream
XINFO GROUPSGet information about consumer groups

HyperLogLog

CommandDescription
PFADDAdd elements to a HyperLogLog
PFCOUNTGet the approximate cardinality
PFMERGEMerge multiple HyperLogLogs into one

Time Series

CommandDescription
TSADDAdd a sample to a time series
TSMADDAdd samples to multiple time series
TSGETGet the latest sample from a time series
TSRANGEQuery samples within a time range
TSMRANGEQuery across multiple time series by label filter
TSINFOGet metadata about a time series

Vectors

CommandDescription
VSETStore a vector with optional metadata
VGETRetrieve a stored vector
VSEARCHSearch for nearest vectors
VCARDGet the total number of stored vectors

Pub/Sub

CommandDescription
PUBLISHPublish a message to a channel
SUBSCRIBESubscribe to one or more channels
PSUBSCRIBESubscribe to channels matching a pattern
UNSUBSCRIBEUnsubscribe from one or more channels
PUNSUBSCRIBEUnsubscribe from channels matching a pattern

KSUB

CommandDescription
KSUBSubscribe to real-time keyspace change notifications
KUNSUBUnsubscribe from keyspace notifications

Tables

CommandDescription
TCREATECreate a table with typed fields and constraints
TINSERTInsert a row into a table
TSELECTSelect rows with WHERE, JOIN, ORDER BY, LIMIT, and OFFSET
TUPDATEUpdate rows matching a WHERE predicate
TDELETEDelete rows matching a WHERE predicate
TDROPDrop an entire table and all its data
TCOUNTCount rows in a table
TSCHEMAShow table schema with field types and constraints
TLISTList all tables

Transactions

CommandDescription
MULTIStart a transaction
EXECExecute all queued commands in a transaction
DISCARDDiscard all queued commands
WATCHWatch keys for changes before a transaction
UNWATCHUnwatch all watched keys

Scripting

CommandDescription
EVALExecute a Lua script
EVALSHAExecute a cached Lua script by SHA hash
SCRIPT LOADLoad a Lua script into the script cache
SCRIPT EXISTSCheck if scripts exist in the cache
SCRIPT FLUSHRemove all scripts from the cache

Sorting

CommandDescription
SORTSort the elements of a list, set, or sorted set
SORT_RORead-only variant of SORT

Server

CommandDescription
PINGTest if the server is alive
ECHOEcho a message back
QUITClose the connection
HELLOHandshake with the server (RESP3)
INFOGet server information and statistics
TIMEReturn the current server time
SAVESynchronously save the dataset to disk
BGSAVEAsynchronously save the dataset to disk
LASTSAVEGet the timestamp of the last save
AUTHAuthenticate with the server
CONFIGGet or set server configuration parameters
CLIENTManage client connections
SELECTSelect the database index
COMMANDGet information about server commands
OBJECTInspect the internals of objects
MEMORYInspect memory usage

Bitops

Bit operations are available through the Strings commands: SETBIT, GETBIT, BITCOUNT, BITPOS, and BITOP. See the Strings section above for details.