Supported and restricted Valkey, Memcached, and Redis OSS commands
Supported Valkey and Redis OSS commands
Supported Valkey and Redis OSS commands
The following Valkey and Redis OSS commands are supported by serverless caches. In addition to these commands, these Supported Valkey and Redis OSS commands are also supported.
For information on Bloom Filter commands see Bloom filter commands
Bitmap Commands
-
BITCOUNTCounts the number of set bits (population counting) in a string.
-
BITFIELDPerforms arbitrary bitfield integer operations on strings.
-
BITFIELD_ROPerforms arbitrary read-only bitfield integer operations on strings.
-
BITOPPerforms bitwise operations on multiple strings, and stores the result.
-
BITPOSFinds the first set (1) or clear (0) bit in a string.
-
GETBITReturns a bit value by offset.
-
SETBITSets or clears the bit at offset of the string value. Creates the key if it doesn't exist.
Cluster Management Commands
-
CLUSTER COUNTKEYSINSLOTReturns the number of keys in a hash slot.
-
CLUSTER GETKEYSINSLOTReturns the key names in a hash slot.
-
CLUSTER INFOReturns information about the state of a node. In a serverless cache, returns state about the single virtual “shard” exposed to the client.
-
CLUSTER KEYSLOTReturns the hash slot for a key.
-
CLUSTER MYIDReturns the ID of a node. In a serverless cache, returns state about the single virtual “shard” exposed to the client.
-
CLUSTER NODESReturns the cluster configuration for a node. In a serverless cache, returns state about the single virtual “shard” exposed to the client.
-
CLUSTER REPLICASLists the replica nodes of a master node. In a serverless cache, returns state about the single virtual “shard” exposed to the client.
-
CLUSTER SHARDSReturns the mapping of cluster slots to shards. In a serverless cache, returns state about the single virtual “shard” exposed to the client.
-
CLUSTER SLOTSReturns the mapping of cluster slots to nodes. In a serverless cache, returns state about the single virtual “shard” exposed to the client.
-
CLUSTER SLOT-STATSAllows tracking of per slot metrics for key count, CPU utilization, network bytes in, and network bytes out.
-
READONLYEnables read-only queries for a connection to a Valkey or Redis OSS Cluster replica node.
-
READWRITEEnables read-write queries for a connection to a Valkey or Redis OSS Cluster replica node.
-
SCRIPT SHOWReturns the original source code of a script in the script cache.
Connection Management Commands
-
AUTHAuthenticates the connection.
-
CLIENT GETNAMEReturns the name of the connection.
-
CLIENT REPLYInstructs the server whether to reply to commands.
-
CLIENT SETNAMESets the connection name.
-
ECHOReturns the given string.
-
HELLOHandshakes with the Valkey or Redis OSS server.
-
PINGReturns the server's liveliness response.
-
QUITCloses the connection.
-
RESETResets the connection.
-
SELECTChanges the selected database.
Generic Commands
-
COPYCopies the value of a key to a new key.
-
DELDeletes one or more keys.
-
DUMPReturns a serialized representation of the value stored at a key.
-
EXISTSDetermines whether one or more keys exist.
-
EXPIRESets the expiration time of a key in seconds.
-
EXPIREATSets the expiration time of a key to a Unix timestamp.
-
EXPIRETIMEReturns the expiration time of a key as a Unix timestamp.
-
PERSISTRemoves the expiration time of a key.
-
PEXPIRESets the expiration time of a key in milliseconds.
-
PEXPIREATSets the expiration time of a key to a Unix milliseconds timestamp.
-
PEXPIRETIMEReturns the expiration time of a key as a Unix milliseconds timestamp.
-
PTTLReturns the expiration time in milliseconds of a key.
-
RANDOMKEYReturns a random key name from the database.
-
RENAMERenames a key and overwrites the destination.
-
RENAMENXRenames a key only when the target key name doesn't exist.
-
RESTORECreates a key from the serialized representation of a value.
-
SCANIterates over the key names in the database.
-
SORTSorts the elements in a list, a set, or a sorted set, optionally storing the result.
-
SORT_ROReturns the sorted elements of a list, a set, or a sorted set.
-
TOUCHReturns the number of existing keys out of those specified after updating the time they were last accessed.
-
TTLReturns the expiration time in seconds of a key.
-
TYPEDetermines the type of value stored at a key.
-
UNLINKAsynchronously deletes one or more keys.
Geospatial Commands
-
GEOADDAdds one or more members to a geospatial index. The key is created if it doesn't exist.
-
GEODISTReturns the distance between two members of a geospatial index.
-
GEOHASHReturns members from a geospatial index as geohash strings.
-
GEOPOSReturns the longitude and latitude of members from a geospatial index.
-
GEORADIUSQueries a geospatial index for members within a distance from a coordinate, optionally stores the result.
-
GEORADIUS_ROReturns members from a geospatial index that are within a distance from a coordinate.
-
GEORADIUSBYMEMBERQueries a geospatial index for members within a distance from a member, optionally stores the result.
-
GEORADIUSBYMEMBER_ROReturns members from a geospatial index that are within a distance from a member.
-
GEOSEARCHQueries a geospatial index for members inside an area of a box or a circle.
-
GEOSEARCHSTOREQueries a geospatial index for members inside an area of a box or a circle, optionally stores the result.
Hash Commands
-
HDELDeletes one or more fields and their values from a hash. Deletes the hash if no fields remain.
-
HEXISTSDetermines whether a field exists in a hash.
-
HGETReturns the value of a field in a hash.
-
HGETALLReturns all fields and values in a hash.
-
HINCRBYIncrements the integer value of a field in a hash by a number. Uses 0 as initial value if the field doesn't exist.
-
HINCRBYFLOATIncrements the floating point value of a field by a number. Uses 0 as initial value if the field doesn't exist.
-
HKEYSReturns all fields in a hash.
-
HLENReturns the number of fields in a hash.
-
HMGETReturns the values of all fields in a hash.
-
HMSETSets the values of multiple fields.
-
HRANDFIELDReturns one or more random fields from a hash.
-
HSCANIterates over fields and values of a hash.
-
HSETCreates or modifies the value of a field in a hash.
-
HSETNXSets the value of a field in a hash only when the field doesn't exist.
-
HSTRLENReturns the length of the value of a field.
-
HVALSReturns all values in a hash.
HyperLogLog Commands
-
PFADDAdds elements to a HyperLogLog key. Creates the key if it doesn't exist.
-
PFCOUNTReturns the approximated cardinality of the set(s) observed by the HyperLogLog key(s).
-
PFMERGEMerges one or more HyperLogLog values into a single key.
List Commands
-
BLMOVEPops an element from a list, pushes it to another list and returns it. Blocks until an element is available otherwise. Deletes the list if the last element was moved.
-
BLMPOPPops the first element from one of multiple lists. Blocks until an element is available otherwise. Deletes the list if the last element was popped.
-
BLPOPRemoves and returns the first element in a list. Blocks until an element is available otherwise. Deletes the list if the last element was popped.
-
BRPOPRemoves and returns the last element in a list. Blocks until an element is available otherwise. Deletes the list if the last element was popped.
-
BRPOPLPUSHPops an element from a list, pushes it to another list and returns it. Block until an element is available otherwise. Deletes the list if the last element was popped.
-
LINDEXReturns an element from a list by its index.
-
LINSERTInserts an element before or after another element in a list.
-
LLENReturns the length of a list.
-
LMOVEReturns an element after popping it from one list and pushing it to another. Deletes the list if the last element was moved.
-
LMPOPReturns multiple elements from a list after removing them. Deletes the list if the last element was popped.
-
LPOPReturns the first elements in a list after removing it. Deletes the list if the last element was popped.
-
LPOSReturns the index of matching elements in a list.
-
LPUSHPrepends one or more elements to a list. Creates the key if it doesn't exist.
-
LPUSHXPrepends one or more elements to a list only when the list exists.
-
LRANGEReturns a range of elements from a list.
-
LREMRemoves elements from a list. Deletes the list if the last element was removed.
-
LSETSets the value of an element in a list by its index.
-
LTRIMRemoves elements from both ends a list. Deletes the list if all elements were trimmed.
-
RPOPReturns and removes the last elements of a list. Deletes the list if the last element was popped.
-
RPOPLPUSHReturns the last element of a list after removing and pushing it to another list. Deletes the list if the last element was popped.
-
RPUSHAppends one or more elements to a list. Creates the key if it doesn't exist.
-
RPUSHXAppends an element to a list only when the list exists.
Pub/Sub Commands
Note
PUBSUB commands internally use sharded PUBSUB, so channel names will be mixed.
-
PUBLISHPosts a message to a channel.
-
PUBSUB CHANNELSReturns the active channels.
-
PUBSUB NUMSUBReturns a count of subscribers to channels.
-
PUBSUB SHARDCHANNELSReturns the active shard channels.
-
PUBSUB SHARDNUMSUBReturns the count of subscribers of shard channels.
-
SPUBLISHPost a message to a shard channel
-
SSUBSCRIBEListens for messages published to shard channels.
-
SUBSCRIBEListens for messages published to channels.
-
SUNSUBSCRIBEStops listening to messages posted to shard channels.
-
UNSUBSCRIBEStops listening to messages posted to channels.
Scripting Commands
-
EVALExecutes a server-side Lua script.
-
EVAL_ROExecutes a read-only server-side Lua script.
-
EVALSHAExecutes a server-side Lua script by SHA1 digest.
-
EVALSHA_ROExecutes a read-only server-side Lua script by SHA1 digest.
-
SCRIPT EXISTSDetermines whether server-side Lua scripts exist in the script cache.
-
SCRIPT FLUSHCurrently a no-op, script cache is managed by the service.
-
SCRIPT LOADLoads a server-side Lua script to the script cache.
Server Management Commands
Note
When using node-based ElastiCache clusters for Valkey and Redis OSS, flush commands must be sent to every primary by the client to flush all keys. ElastiCache Serverless for Valkey and Redis OSS works differently, because it abstracts away the underlying cluster topology. The result is that in ElastiCache Serverless, FLUSHDB and FLUSHALL commands will always flush all keys across the cluster. For this reason, flush commands cannot be included inside a Serverless transaction.
-
ACL CATLists the ACL categories, or the commands inside a category.
-
ACL GENPASSGenerates a pseudorandom, secure password that can be used to identify ACL users.
-
ACL GETUSERLists the ACL rules of a user.
-
ACL LISTDumps the effective rules in ACL file format.
-
ACL USERSLists all ACL users.
-
ACL WHOAMIReturns the authenticated username of the current connection.
-
DBSIZEReturn the number of keys in the currently-selected database. This operation is not guaranteed to be atomic across all slots.
-
COMMANDReturns detailed information about all commands.
-
COMMAND COUNTReturns a count of commands.
-
COMMAND DOCSReturns documentary information about one, multiple or all commands.
-
COMMAND GETKEYSExtracts the key names from an arbitrary command.
-
COMMAND GETKEYSANDFLAGSExtracts the key names and access flags for an arbitrary command.
-
COMMAND INFOReturns information about one, multiple or all commands.
-
COMMAND LISTReturns a list of command names.
-
COMMANDLOGA container for command log commands.
-
COMMANDLOG GETReturns the specified command log's entries.
-
COMMANDLOG HELPShow helpful text about the different subcommands.
-
COMMANDLOG LENReturns the number of entries in the specified type of command log.
-
COMMANDLOG RESETClears all entries from the specified type of command log.
-
FLUSHALLRemoves all keys from all databases. This operation is not guaranteed to be atomic across all slots.
-
FLUSHDBRemove all keys from the current database. This operation is not guaranteed to be atomic across all slots.
-
INFOReturns information and statistics about the server.
-
LOLWUTDisplays computer art and the Valkey or Redis OSS version.
-
ROLEReturns the replication role.
-
TIMEReturns the server time.
Set Commands
-
SADDAdds one or more members to a set. Creates the key if it doesn't exist.
-
SCARDReturns the number of members in a set.
-
SDIFFReturns the difference of multiple sets.
-
SDIFFSTOREStores the difference of multiple sets in a key.
-
SINTERReturns the intersect of multiple sets.
-
SINTERCARDReturns the number of members of the intersect of multiple sets.
-
SINTERSTOREStores the intersect of multiple sets in a key.
-
SISMEMBERDetermines whether a member belongs to a set.
-
SMEMBERSReturns all members of a set.
-
SMISMEMBERDetermines whether multiple members belong to a set.
-
SMOVEMoves a member from one set to another.
-
SPOPReturns one or more random members from a set after removing them. Deletes the set if the last member was popped.
-
SRANDMEMBERGet one or multiple random members from a set
-
SREMRemoves one or more members from a set. Deletes the set if the last member was removed.
-
SSCANIterates over members of a set.
-
SUNIONReturns the union of multiple sets.
-
SUNIONSTOREStores the union of multiple sets in a key.
Sorted Set Commands
-
BZMPOPRemoves and returns a member by score from one or more sorted sets. Blocks until a member is available otherwise. Deletes the sorted set if the last element was popped.
-
BZPOPMAXRemoves and returns the member with the highest score from one or more sorted sets. Blocks until a member available otherwise. Deletes the sorted set if the last element was popped.
-
BZPOPMINRemoves and returns the member with the lowest score from one or more sorted sets. Blocks until a member is available otherwise. Deletes the sorted set if the last element was popped.
-
ZADDAdds one or more members to a sorted set, or updates their scores. Creates the key if it doesn't exist.
-
ZCARDReturns the number of members in a sorted set.
-
ZCOUNTReturns the count of members in a sorted set that have scores within a range.
-
ZDIFFReturns the difference between multiple sorted sets.
-
ZDIFFSTOREStores the difference of multiple sorted sets in a key.
-
ZINCRBYIncrements the score of a member in a sorted set.
-
ZINTERReturns the intersect of multiple sorted sets.
-
ZINTERCARDReturns the number of members of the intersect of multiple sorted sets.
-
ZINTERSTOREStores the intersect of multiple sorted sets in a key.
-
ZLEXCOUNTReturns the number of members in a sorted set within a lexicographical range.
-
ZMPOPReturns the highest- or lowest-scoring members from one or more sorted sets after removing them. Deletes the sorted set if the last member was popped.
-
ZMSCOREReturns the score of one or more members in a sorted set.
-
ZPOPMAXReturns the highest-scoring members from a sorted set after removing them. Deletes the sorted set if the last member was popped.
-
ZPOPMINReturns the lowest-scoring members from a sorted set after removing them. Deletes the sorted set if the last member was popped.
-
ZRANDMEMBERReturns one or more random members from a sorted set.
-
ZRANGEReturns members in a sorted set within a range of indexes.
-
ZRANGEBYLEXReturns members in a sorted set within a lexicographical range.
-
ZRANGEBYSCOREReturns members in a sorted set within a range of scores.
-
ZRANGESTOREStores a range of members from sorted set in a key.
-
ZRANKReturns the index of a member in a sorted set ordered by ascending scores.
-
ZREMRemoves one or more members from a sorted set. Deletes the sorted set if all members were removed.
-
ZREMRANGEBYLEXRemoves members in a sorted set within a lexicographical range. Deletes the sorted set if all members were removed.
-
ZREMRANGEBYRANKRemoves members in a sorted set within a range of indexes. Deletes the sorted set if all members were removed.
-
ZREMRANGEBYSCORERemoves members in a sorted set within a range of scores. Deletes the sorted set if all members were removed.
-
ZREVRANGEReturns members in a sorted set within a range of indexes in reverse order.
-
ZREVRANGEBYLEXReturns members in a sorted set within a lexicographical range in reverse order.
-
ZREVRANGEBYSCOREReturns members in a sorted set within a range of scores in reverse order.
-
ZREVRANKReturns the index of a member in a sorted set ordered by descending scores.
-
ZSCANIterates over members and scores of a sorted set.
-
ZSCOREReturns the score of a member in a sorted set.
-
ZUNIONReturns the union of multiple sorted sets.
-
ZUNIONSTOREStores the union of multiple sorted sets in a key.
Stream Commands
-
XACKReturns the number of messages that were successfully acknowledged by the consumer group member of a stream.
-
XADDAppends a new message to a stream. Creates the key if it doesn't exist.
-
XAUTOCLAIMChanges, or acquires, ownership of messages in a consumer group, as if the messages were delivered to as consumer group member.
-
XCLAIMChanges, or acquires, ownership of a message in a consumer group, as if the message was delivered a consumer group member.
-
XDELReturns the number of messages after removing them from a stream.
-
XGROUP CREATECreates a consumer group.
-
XGROUP CREATECONSUMERCreates a consumer in a consumer group.
-
XGROUP DELCONSUMERDeletes a consumer from a consumer group.
-
XGROUP DESTROYDestroys a consumer group.
-
XGROUP SETIDSets the last-delivered ID of a consumer group.
-
XINFO CONSUMERSReturns a list of the consumers in a consumer group.
-
XINFO GROUPSReturns a list of the consumer groups of a stream.
-
XINFO STREAMReturns information about a stream.
-
XLENReturn the number of messages in a stream.
-
XPENDINGReturns the information and entries from a stream consumer group's pending entries list.
-
XRANGEReturns the messages from a stream within a range of IDs.
-
XREADReturns messages from multiple streams with IDs greater than the ones requested. Blocks until a message is available otherwise.
-
XREADGROUPReturns new or historical messages from a stream for a consumer in a group. Blocks until a message is available otherwise.
-
XREVRANGEReturns the messages from a stream within a range of IDs in reverse order.
-
XTRIMDeletes messages from the beginning of a stream.
String Commands
-
APPENDAppends a string to the value of a key. Creates the key if it doesn't exist.
-
DECRDecrements the integer value of a key by one. Uses 0 as initial value if the key doesn't exist.
-
DECRBYDecrements a number from the integer value of a key. Uses 0 as initial value if the key doesn't exist.
-
GETReturns the string value of a key.
-
GETDELReturns the string value of a key after deleting the key.
-
GETEXReturns the string value of a key after setting its expiration time.
-
GETRANGEReturns a substring of the string stored at a key.
-
GETSETReturns the previous string value of a key after setting it to a new value.
-
INCRIncrements the integer value of a key by one. Uses 0 as initial value if the key doesn't exist.
-
INCRBYIncrements the integer value of a key by a number. Uses 0 as initial value if the key doesn't exist.
-
INCRBYFLOATIncrement the floating point value of a key by a number. Uses 0 as initial value if the key doesn't exist.
-
LCSFinds the longest common substring.
-
MGETAtomically returns the string values of one or more keys.
-
MSETAtomically creates or modifies the string values of one or more keys.
-
MSETNXAtomically modifies the string values of one or more keys only when all keys don't exist.
-
PSETEXSets both string value and expiration time in milliseconds of a key. The key is created if it doesn't exist.
-
SETSets the string value of a key, ignoring its type. The key is created if it doesn't exist.
-
SETEXSets the string value and expiration time of a key. Creates the key if it doesn't exist.
-
SETNXSet the string value of a key only when the key doesn't exist.
-
SETRANGEOverwrites a part of a string value with another by an offset. Creates the key if it doesn't exist.
-
STRLENReturns the length of a string value.
-
SUBSTRReturns a substring from a string value.
Transaction Commands
-
DISCARDDiscards a transaction.
-
EXECExecutes all commands in a transaction.
-
MULTIStarts a transaction.
Restricted Valkey and Redis OSS commands
To deliver a managed service experience, ElastiCache restricts access to certain cache engine-specific commands that require advanced privileges. For caches running Redis OSS, the following commands are unavailable:
acl setuseracl loadacl saveacl deluserbgrewriteaofbgsavecluster addslotcluster addslotsrangecluster bumpepochcluster delslotcluster delslotsrangecluster failovercluster flushslotscluster forgetcluster linkscluster meetcluster setslotconfigdebugmigratepsyncreplicaofsaveslaveofshutdownsync
In addition, the following commands are unavailable for serverless caches:
acl logclient cachingclient getredirclient idclient infoclient killclient listclient no-evictclient pauseclient trackingclient trackinginfoclient unblockclient unpausecluster count-failure-reportscommandlogcommandlog getcommandlog helpcommandlog lencommandlog resetfcallfcall_rofunctionfunction deletefunction dumpfunction flushfunction helpfunction killfunction listfunction loadfunction restorefunction statskeyslastsavelatencylatency doctorlatency graphlatency helplatency histogramlatency historylatency latestlatency resetmemorymemory doctormemory helpmemory malloc-statsmemory purgememory statsmemory usagemonitormoveobjectobject encodingobject freqobject helpobject idletimeobject refcountpfdebugpfselftestpsubscribepubsub numpatpunsubscribescript killslowlogslowlog getslowlog helpslowlog lenslowlog resetswapdbunwatchwaitwatch
Supported Memcached commands
ElastiCache Serverless for Memcached supports all of the memcached
commands
Client connections require TLS, as a result UDP protocol is not supported.
Binary protocol is not supported, as it is officially deprecated
in memcached 1.6. GET/GETScommands are limited to 16KB to avoid potential DoS attack to the server with fetching large number of keys.Delayed
flush_allcommand will be rejected withCLIENT_ERROR.Commands that configure the engine or reveal internal information about engine state or logs are not supported, such as:
For
STATScommand, onlystatsandstats resetare supported. Other variations will returnERRORlru / lru_crawler- modification for LRU and LRU crawler settingswatch- watches memcached server logsverbosity- configures the server log levelme- meta debug (me) command is not supported