Unverified Commit 86781600 authored by guybe7's avatar guybe7 Committed by GitHub
Browse files

Auto-generate the command table from JSON files (#9656)

Delete the hardcoded command table and replace it with an auto-generated table, based
on a JSON file that describes the commands (each command must have a JSON file).

These JSON files are the SSOT of everything there is to know about Redis commands,
and it is reflected fully in COMMAND INFO.

These JSON files are used to generate commands.c (using a python script), which is then
committed to the repo and compiled.

The purpose is:
* Clients and proxies will be able to get much more info from redis, instead of relying on hard coded logic.
* drop the dependency between Redis-user and the commands.json in redis-doc.
* delete help.h and have redis-cli learn everything it needs to know just by issuing COMMAND (will be
  done in a separate PR)
* redis.io should stop using commands.json and learn everything from Redis (ultimately one of the release
  artifacts should be a large JSON, containing all the information about all of the commands, which will be
  generated from COMMAND's reply)
* the byproduct of this is:
  * module commands will be able to provide that info and possibly be more of a first-class citizens
  * in theory, one may be able to generate a redis client library for a strictly typed language, by using this info.

### Interface changes

#### COMMAND INFO's reply change (and arg-less COMMAND)

Before this commit the reply at index 7 contained the key-specs list
and reply at index 8 contained the sub-commands list (Both unreleased).
Now, reply at index 7 is a map of:
- summary - short command description
- since - debut version
- group - command group
- complexity - complexity string
- doc-flags - flags used for documentation (e.g. "deprecated")
- deprecated-since - if deprecated, from which version?
- replaced-by - if deprecated, which command replaced it?
- history - a list of (version, what-changed) tuples
- hints - a list of strings, meant to provide hints for clients/proxies. see https://github.com/redis/redis/issues/9876
- arguments - an array of arguments. each element is a map, with the possibility of nesting (sub-arguments)
- key-specs - an array of keys specs (already in unstable, just changed location)
- subcommands - a list of sub-commands (already in unstable, just changed location)
- reply-schema - will be added in the future (see https://github.com/redis/redis/issues/9845)

more details on these can be found in https://github.com/redis/redis-doc/pull/1697

only the first three fields are mandatory 

#### API changes (unreleased API obviously)

now they take RedisModuleCommand opaque pointer instead of looking up the command by name

- RM_CreateSubcommand
- RM_AddCommandKeySpec
- RM_SetCommandKeySpecBeginSearchIndex
- RM_SetCommandKeySpecBeginSearchKeyword
- RM_SetCommandKeySpecFindKeysRange
- RM_SetCommandKeySpecFindKeysKeynum

Currently, we did not add module API to provide additional information about their commands because
we couldn't agree on how the API should look like, see https://github.com/redis/redis/issues/9944

.

### Somehow related changes
1. Literals should be in uppercase while placeholder in lowercase. Now all the GEO* command
   will be documented with M|KM|FT|MI and can take both lowercase and uppercase

### Unrelated changes
1. Bugfix: no_madaory_keys was absent in COMMAND's reply
2. expose CMD_MODULE as "module" via COMMAND
3. have a dedicated uint64 for ACL categories (instead of having them in the same uint64 as command flags)
Co-authored-by: default avatarItamar Haber <itamar@garantiadata.com>
parent fbfdf513
{
"GEOADD": {
"summary": "Add one or more geospatial items in the geospatial index represented using a sorted set",
"complexity": "O(log(N)) for each item added, where N is the number of elements in the sorted set.",
"group": "geo",
"since": "3.2.0",
"arity": -5,
"function": "geoaddCommand",
"history": [
[
"6.2",
"Added the `CH`, `NX` and `XX` options."
]
],
"command_flags": [
"WRITE",
"DENYOOM"
],
"acl_categories": [
"GEO"
],
"key_specs": [
{
"flags": [
"WRITE"
],
"begin_search": {
"index": {
"pos": 1
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
}
],
"arguments": [
{
"name": "key",
"type": "key",
"key_spec_index": 0
},
{
"name": "condition",
"type": "oneof",
"optional": true,
"arguments": [
{
"name": "nx",
"type": "pure-token",
"token": "NX"
},
{
"name": "xx",
"type": "pure-token",
"token": "XX"
}
]
},
{
"name": "change",
"token": "CH",
"type": "pure-token",
"optional": true
},
{
"name": "longitude_latitude_member",
"type": "block",
"multiple": true,
"arguments": [
{
"name": "longitude",
"type": "double"
},
{
"name": "latitude",
"type": "double"
},
{
"name": "member",
"type": "string"
}
]
}
]
}
}
{
"GEODIST": {
"summary": "Returns the distance between two members of a geospatial index",
"complexity": "O(log(N))",
"group": "geo",
"since": "3.2.0",
"arity": -4,
"function": "geodistCommand",
"command_flags": [
"READONLY"
],
"acl_categories": [
"GEO"
],
"key_specs": [
{
"flags": [
"READ"
],
"begin_search": {
"index": {
"pos": 1
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
}
],
"arguments": [
{
"name": "key",
"type": "key",
"key_spec_index": 0
},
{
"name": "member1",
"type": "string"
},
{
"name": "member2",
"type": "string"
},
{
"name": "unit",
"type": "oneof",
"optional": true,
"arguments": [
{
"name": "m",
"type": "pure-token",
"token": "m"
},
{
"name": "km",
"type": "pure-token",
"token": "km"
},
{
"name": "ft",
"type": "pure-token",
"token": "ft"
},
{
"name": "mi",
"type": "pure-token",
"token": "mi"
}
]
}
]
}
}
{
"GEOHASH": {
"summary": "Returns members of a geospatial index as standard geohash strings",
"complexity": "O(log(N)) for each member requested, where N is the number of elements in the sorted set.",
"group": "geo",
"since": "3.2.0",
"arity": -2,
"function": "geohashCommand",
"command_flags": [
"READONLY"
],
"acl_categories": [
"GEO"
],
"key_specs": [
{
"flags": [
"READ"
],
"begin_search": {
"index": {
"pos": 1
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
}
],
"arguments": [
{
"name": "key",
"type": "key",
"key_spec_index": 0
},
{
"name": "member",
"type": "string",
"multiple": true
}
]
}
}
{
"GEOPOS": {
"summary": "Returns longitude and latitude of members of a geospatial index",
"complexity": "O(N) where N is the number of members requested.",
"group": "geo",
"since": "3.2.0",
"arity": -2,
"function": "geoposCommand",
"command_flags": [
"READONLY"
],
"acl_categories": [
"GEO"
],
"key_specs": [
{
"flags": [
"READ"
],
"begin_search": {
"index": {
"pos": 1
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
}
],
"arguments": [
{
"name": "key",
"type": "key",
"key_spec_index": 0
},
{
"name": "member",
"type": "string",
"multiple": true
}
]
}
}
{
"GEORADIUS": {
"summary": "Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point",
"complexity": "O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.",
"group": "geo",
"since": "3.2.0",
"arity": -6,
"function": "georadiusCommand",
"get_keys_function": "georadiusGetKeys",
"history": [
[
"6.2",
"Added the `ANY` option for `COUNT`."
]
],
"deprecated_since": "6.2.0",
"replaced_by": "`GEOSEARCH` and `GEOSEARCHSTORE` with the `BYRADIUS` argument",
"doc_flags": [
"DEPRECATED"
],
"command_flags": [
"WRITE",
"DENYOOM"
],
"acl_categories": [
"GEO"
],
"key_specs": [
{
"flags": [
"READ"
],
"begin_search": {
"index": {
"pos": 1
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
},
{
"flags": [
"WRITE"
],
"begin_search": {
"keyword": {
"keyword": "STORE",
"startfrom": 6
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
},
{
"flags": [
"WRITE"
],
"begin_search": {
"keyword": {
"keyword": "STOREDIST",
"startfrom": 6
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
}
],
"arguments": [
{
"name": "key",
"type": "key",
"key_spec_index": 0
},
{
"name": "longitude",
"type": "double"
},
{
"name": "latitude",
"type": "double"
},
{
"name": "radius",
"type": "double"
},
{
"name": "unit",
"type": "oneof",
"arguments": [
{
"name": "m",
"type": "pure-token",
"token": "m"
},
{
"name": "km",
"type": "pure-token",
"token": "km"
},
{
"name": "ft",
"type": "pure-token",
"token": "ft"
},
{
"name": "mi",
"type": "pure-token",
"token": "mi"
}
]
},
{
"name": "withcoord",
"token": "WITHCOORD",
"type": "pure-token",
"optional": true
},
{
"name": "withdist",
"token": "WITHDIST",
"type": "pure-token",
"optional": true
},
{
"name": "withhash",
"token": "WITHHASH",
"type": "pure-token",
"optional": true
},
{
"name": "count",
"type": "block",
"optional": true,
"arguments": [
{
"token": "COUNT",
"name": "count",
"type": "integer"
},
{
"name": "any",
"token": "ANY",
"type": "pure-token",
"optional": true
}
]
},
{
"name": "order",
"type": "oneof",
"optional": true,
"arguments": [
{
"name": "asc",
"type": "pure-token",
"token": "ASC"
},
{
"name": "desc",
"type": "pure-token",
"token": "DESC"
}
]
},
{
"token": "STORE",
"name": "key",
"type": "key",
"key_spec_index": 1,
"optional": true
},
{
"token": "STOREDIST",
"name": "key",
"type": "key",
"key_spec_index": 2,
"optional": true
}
]
}
}
{
"GEORADIUS_RO": {
"summary": "A read-only variant for GEORADIUS",
"complexity": "O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.",
"group": "geo",
"since": "5.0.0",
"arity": -6,
"function": "georadiusroCommand",
"deprecated_since": "6.2.0",
"replaced_by": "`GEOSEARCH` with the `BYRADIUS` argument",
"doc_flags": [
"DEPRECATED"
],
"command_flags": [
"READONLY"
],
"acl_categories": [
"GEO"
],
"key_specs": [
{
"flags": [
"READ"
],
"begin_search": {
"index": {
"pos": 1
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
}
],
"arguments": [
{
"name": "key",
"type": "key",
"key_spec_index": 0
},
{
"name": "longitude",
"type": "double"
},
{
"name": "latitude",
"type": "double"
},
{
"name": "radius",
"type": "double"
},
{
"name": "unit",
"type": "oneof",
"arguments": [
{
"name": "m",
"type": "pure-token",
"token": "m"
},
{
"name": "km",
"type": "pure-token",
"token": "km"
},
{
"name": "ft",
"type": "pure-token",
"token": "ft"
},
{
"name": "mi",
"type": "pure-token",
"token": "mi"
}
]
},
{
"name": "withcoord",
"token": "WITHCOORD",
"type": "pure-token",
"optional": true
},
{
"name": "withdist",
"token": "WITHDIST",
"type": "pure-token",
"optional": true
},
{
"name": "withhash",
"token": "WITHHASH",
"type": "pure-token",
"optional": true
},
{
"name": "count",
"type": "block",
"optional": true,
"arguments": [
{
"token": "COUNT",
"name": "count",
"type": "integer"
},
{
"name": "any",
"token": "ANY",
"type": "pure-token",
"optional": true
}
]
},
{
"name": "order",
"type": "oneof",
"optional": true,
"arguments": [
{
"name": "asc",
"type": "pure-token",
"token": "ASC"
},
{
"name": "desc",
"type": "pure-token",
"token": "DESC"
}
]
}
]
}
}
{
"GEORADIUSBYMEMBER": {
"summary": "Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member",
"complexity": "O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.",
"group": "geo",
"since": "3.2.0",
"arity": -5,
"function": "georadiusbymemberCommand",
"get_keys_function": "georadiusGetKeys",
"deprecated_since": "6.2.0",
"replaced_by": "`GEOSEARCH` and `GEOSEARCHSTORE` with the `BYRADIUS` and `FROMMEMBER` arguments",
"doc_flags": [
"DEPRECATED"
],
"command_flags": [
"WRITE",
"DENYOOM"
],
"acl_categories": [
"GEO"
],
"key_specs": [
{
"flags": [
"READ"
],
"begin_search": {
"index": {
"pos": 1
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
},
{
"flags": [
"WRITE"
],
"begin_search": {
"keyword": {
"keyword": "STORE",
"startfrom": 5
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
},
{
"flags": [
"WRITE"
],
"begin_search": {
"keyword": {
"keyword": "STOREDIST",
"startfrom": 5
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
}
],
"arguments": [
{
"name": "key",
"type": "key",
"key_spec_index": 0
},
{
"name": "member",
"type": "string"
},
{
"name": "radius",
"type": "double"
},
{
"name": "unit",
"type": "oneof",
"arguments": [
{
"name": "m",
"type": "pure-token",
"token": "m"
},
{
"name": "km",
"type": "pure-token",
"token": "km"
},
{
"name": "ft",
"type": "pure-token",
"token": "ft"
},
{
"name": "mi",
"type": "pure-token",
"token": "mi"
}
]
},
{
"name": "withcoord",
"token": "WITHCOORD",
"type": "pure-token",
"optional": true
},
{
"name": "withdist",
"token": "WITHDIST",
"type": "pure-token",
"optional": true
},
{
"name": "withhash",
"token": "WITHHASH",
"type": "pure-token",
"optional": true
},
{
"name": "count",
"type": "block",
"optional": true,
"arguments": [
{
"token": "COUNT",
"name": "count",
"type": "integer"
},
{
"name": "any",
"token": "ANY",
"type": "pure-token",
"optional": true
}
]
},
{
"name": "order",
"type": "oneof",
"optional": true,
"arguments": [
{
"name": "asc",
"type": "pure-token",
"token": "ASC"
},
{
"name": "desc",
"type": "pure-token",
"token": "DESC"
}
]
},
{
"token": "STORE",
"name": "key",
"type": "key",
"key_spec_index": 1,
"optional": true
},
{
"token": "STOREDIST",
"name": "key",
"type": "key",
"key_spec_index": 2,
"optional": true
}
]
}
}
{
"GEORADIUSBYMEMBER_RO": {
"summary": "A read-only variant for GEORADIUSBYMEMBER",
"complexity": "O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.",
"group": "geo",
"since": "5.0.0",
"arity": -5,
"function": "georadiusbymemberroCommand",
"deprecated_since": "6.2.0",
"replaced_by": "`GEOSEARCH` with the `BYRADIUS` and `FROMMEMBER` arguments",
"doc_flags": [
"DEPRECATED"
],
"command_flags": [
"READONLY"
],
"acl_categories": [
"GEO"
],
"key_specs": [
{
"flags": [
"READ"
],
"begin_search": {
"index": {
"pos": 1
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
}
],
"arguments": [
{
"name": "key",
"type": "key",
"key_spec_index": 0
},
{
"name": "member",
"type": "string"
},
{
"name": "radius",
"type": "double"
},
{
"name": "unit",
"type": "oneof",
"arguments": [
{
"name": "m",
"type": "pure-token",
"token": "m"
},
{
"name": "km",
"type": "pure-token",
"token": "km"
},
{
"name": "ft",
"type": "pure-token",
"token": "ft"
},
{
"name": "mi",
"type": "pure-token",
"token": "mi"
}
]
},
{
"name": "withcoord",
"token": "WITHCOORD",
"type": "pure-token",
"optional": true
},
{
"name": "withdist",
"token": "WITHDIST",
"type": "pure-token",
"optional": true
},
{
"name": "withhash",
"token": "WITHHASH",
"type": "pure-token",
"optional": true
},
{
"name": "count",
"type": "block",
"optional": true,
"arguments": [
{
"token": "COUNT",
"name": "count",
"type": "integer"
},
{
"name": "any",
"token": "ANY",
"type": "pure-token",
"optional": true
}
]
},
{
"name": "order",
"type": "oneof",
"optional": true,
"arguments": [
{
"name": "asc",
"type": "pure-token",
"token": "ASC"
},
{
"name": "desc",
"type": "pure-token",
"token": "DESC"
}
]
}
]
}
}
{
"GEOSEARCH": {
"summary": "Query a sorted set representing a geospatial index to fetch members inside an area of a box or a circle.",
"complexity": "O(N+log(M)) where N is the number of elements in the grid-aligned bounding box area around the shape provided as the filter and M is the number of items inside the shape",
"group": "geo",
"since": "6.2",
"arity": -7,
"function": "geosearchCommand",
"command_flags": [
"READONLY"
],
"acl_categories": [
"GEO"
],
"key_specs": [
{
"flags": [
"READ"
],
"begin_search": {
"index": {
"pos": 1
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
}
],
"arguments": [
{
"name": "key",
"type": "key",
"key_spec_index": 0
},
{
"token": "FROMMEMBER",
"name": "member",
"type": "string",
"optional": true
},
{
"token": "FROMLONLAT",
"name": "longitude_latitude",
"type": "block",
"optional": true,
"arguments": [
{
"name": "longitude",
"type": "double"
},
{
"name": "latitude",
"type": "double"
}
]
},
{
"name": "circle",
"type": "block",
"optional": true,
"arguments": [
{
"token": "BYRADIUS",
"name": "radius",
"type": "double"
},
{
"name": "unit",
"type": "oneof",
"arguments": [
{
"name": "m",
"type": "pure-token",
"token": "m"
},
{
"name": "km",
"type": "pure-token",
"token": "km"
},
{
"name": "ft",
"type": "pure-token",
"token": "ft"
},
{
"name": "mi",
"type": "pure-token",
"token": "mi"
}
]
}
]
},
{
"name": "box",
"type": "block",
"optional": true,
"arguments": [
{
"token": "BYBOX",
"name": "width",
"type": "double"
},
{
"name": "height",
"type": "double"
},
{
"name": "unit",
"type": "oneof",
"arguments": [
{
"name": "m",
"type": "pure-token",
"token": "m"
},
{
"name": "km",
"type": "pure-token",
"token": "km"
},
{
"name": "ft",
"type": "pure-token",
"token": "ft"
},
{
"name": "mi",
"type": "pure-token",
"token": "mi"
}
]
}
]
},
{
"name": "order",
"type": "oneof",
"optional": true,
"arguments": [
{
"name": "asc",
"type": "pure-token",
"token": "ASC"
},
{
"name": "desc",
"type": "pure-token",
"token": "DESC"
}
]
},
{
"name": "count",
"type": "block",
"optional": true,
"arguments": [
{
"token": "COUNT",
"name": "count",
"type": "integer"
},
{
"name": "any",
"token": "ANY",
"type": "pure-token",
"optional": true
}
]
},
{
"name": "withcoord",
"token": "WITHCOORD",
"type": "pure-token",
"optional": true
},
{
"name": "withdist",
"token": "WITHDIST",
"type": "pure-token",
"optional": true
},
{
"name": "withhash",
"token": "WITHHASH",
"type": "pure-token",
"optional": true
}
]
}
}
{
"GEOSEARCHSTORE": {
"summary": "Query a sorted set representing a geospatial index to fetch members inside an area of a box or a circle, and store the result in another key.",
"complexity": "O(N+log(M)) where N is the number of elements in the grid-aligned bounding box area around the shape provided as the filter and M is the number of items inside the shape",
"group": "geo",
"since": "6.2",
"arity": -8,
"function": "geosearchstoreCommand",
"command_flags": [
"WRITE",
"DENYOOM"
],
"acl_categories": [
"GEO"
],
"key_specs": [
{
"flags": [
"WRITE"
],
"begin_search": {
"index": {
"pos": 1
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
},
{
"flags": [
"READ"
],
"begin_search": {
"index": {
"pos": 2
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
}
],
"arguments": [
{
"name": "destination",
"type": "key",
"key_spec_index": 0
},
{
"name": "source",
"type": "key",
"key_spec_index": 1
},
{
"token": "FROMMEMBER",
"name": "member",
"type": "string",
"optional": true
},
{
"token": "FROMLONLAT",
"name": "longitude_latitude",
"type": "block",
"optional": true,
"arguments": [
{
"name": "longitude",
"type": "double"
},
{
"name": "latitude",
"type": "double"
}
]
},
{
"name": "circle",
"type": "block",
"optional": true,
"arguments": [
{
"token": "BYRADIUS",
"name": "radius",
"type": "double"
},
{
"name": "unit",
"type": "oneof",
"arguments": [
{
"name": "m",
"type": "pure-token",
"token": "m"
},
{
"name": "km",
"type": "pure-token",
"token": "km"
},
{
"name": "ft",
"type": "pure-token",
"token": "ft"
},
{
"name": "mi",
"type": "pure-token",
"token": "mi"
}
]
}
]
},
{
"name": "box",
"type": "block",
"optional": true,
"arguments": [
{
"token": "BYBOX",
"name": "width",
"type": "double"
},
{
"name": "height",
"type": "double"
},
{
"name": "unit",
"type": "oneof",
"arguments": [
{
"name": "m",
"type": "pure-token",
"token": "m"
},
{
"name": "km",
"type": "pure-token",
"token": "km"
},
{
"name": "ft",
"type": "pure-token",
"token": "ft"
},
{
"name": "mi",
"type": "pure-token",
"token": "mi"
}
]
}
]
},
{
"name": "order",
"type": "oneof",
"optional": true,
"arguments": [
{
"name": "asc",
"type": "pure-token",
"token": "ASC"
},
{
"name": "desc",
"type": "pure-token",
"token": "DESC"
}
]
},
{
"name": "count",
"type": "block",
"optional": true,
"arguments": [
{
"token": "COUNT",
"name": "count",
"type": "integer"
},
{
"name": "any",
"token": "ANY",
"type": "pure-token",
"optional": true
}
]
},
{
"name": "storedist",
"token": "STOREDIST",
"type": "pure-token",
"optional": true
}
]
}
}
{
"GET": {
"summary": "Get the value of a key",
"complexity": "O(1)",
"group": "string",
"since": "1.0.0",
"arity": 2,
"function": "getCommand",
"command_flags": [
"READONLY",
"FAST"
],
"acl_categories": [
"STRING"
],
"key_specs": [
{
"flags": [
"READ"
],
"begin_search": {
"index": {
"pos": 1
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
}
],
"arguments": [
{
"name": "key",
"type": "key",
"key_spec_index": 0
}
]
}
}
{
"GETBIT": {
"summary": "Returns the bit value at offset in the string value stored at key",
"complexity": "O(1)",
"group": "bitmap",
"since": "2.2.0",
"arity": 3,
"function": "getbitCommand",
"command_flags": [
"READONLY",
"FAST"
],
"acl_categories": [
"BITMAP"
],
"key_specs": [
{
"flags": [
"READ"
],
"begin_search": {
"index": {
"pos": 1
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
}
],
"arguments": [
{
"name": "key",
"type": "key",
"key_spec_index": 0
},
{
"name": "offset",
"type": "integer"
}
]
}
}
{
"GETDEL": {
"summary": "Get the value of a key and delete the key",
"complexity": "O(1)",
"group": "string",
"since": "6.2.0",
"arity": 2,
"function": "getdelCommand",
"command_flags": [
"WRITE",
"FAST"
],
"acl_categories": [
"STRING"
],
"key_specs": [
{
"flags": [
"WRITE"
],
"begin_search": {
"index": {
"pos": 1
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
}
],
"arguments": [
{
"name": "key",
"type": "key",
"key_spec_index": 0
}
]
}
}
{
"GETEX": {
"summary": "Get the value of a key and optionally set its expiration",
"complexity": "O(1)",
"group": "string",
"since": "6.2.0",
"arity": -2,
"function": "getexCommand",
"command_flags": [
"WRITE",
"FAST"
],
"acl_categories": [
"STRING"
],
"key_specs": [
{
"flags": [
"WRITE"
],
"begin_search": {
"index": {
"pos": 1
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
}
],
"arguments": [
{
"name": "key",
"type": "key",
"key_spec_index": 0
},
{
"name": "expiration",
"type": "oneof",
"optional": true,
"arguments": [
{
"name": "seconds",
"type": "integer",
"token": "EX"
},
{
"name": "milliseconds",
"type": "integer",
"token": "PX"
},
{
"name": "unix-time",
"type": "integer",
"token": "EXAT"
},
{
"name": "unix-time",
"type": "integer",
"token": "PXAT"
},
{
"name": "persist",
"type": "pure-token",
"token": "PERSIST"
}
]
}
]
}
}
{
"GETRANGE": {
"summary": "Get a substring of the string stored at a key",
"complexity": "O(N) where N is the length of the returned string. The complexity is ultimately determined by the returned length, but because creating a substring from an existing string is very cheap, it can be considered O(1) for small strings.",
"group": "string",
"since": "2.4.0",
"arity": 4,
"function": "getrangeCommand",
"command_flags": [
"READONLY"
],
"acl_categories": [
"STRING"
],
"key_specs": [
{
"flags": [
"READ"
],
"begin_search": {
"index": {
"pos": 1
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
}
],
"arguments": [
{
"name": "key",
"type": "key",
"key_spec_index": 0
},
{
"name": "start",
"type": "integer"
},
{
"name": "end",
"type": "integer"
}
]
}
}
{
"GETSET": {
"summary": "Set the string value of a key and return its old value",
"complexity": "O(1)",
"group": "string",
"since": "1.0.0",
"arity": 3,
"function": "getsetCommand",
"deprecated_since": "6.2.0",
"replaced_by": "`SET` with the `!GET` argument",
"doc_flags": [
"DEPRECATED"
],
"command_flags": [
"WRITE",
"DENYOOM",
"FAST"
],
"acl_categories": [
"STRING"
],
"key_specs": [
{
"flags": [
"WRITE",
"READ"
],
"begin_search": {
"index": {
"pos": 1
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
}
],
"arguments": [
{
"name": "key",
"type": "key",
"key_spec_index": 0
},
{
"name": "value",
"type": "string"
}
]
}
}
{
"HDEL": {
"summary": "Delete one or more hash fields",
"complexity": "O(N) where N is the number of fields to be removed.",
"group": "hash",
"since": "2.0.0",
"arity": -3,
"function": "hdelCommand",
"command_flags": [
"WRITE",
"FAST"
],
"acl_categories": [
"HASH"
],
"key_specs": [
{
"flags": [
"WRITE"
],
"begin_search": {
"index": {
"pos": 1
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
}
],
"arguments": [
{
"name": "key",
"type": "key",
"key_spec_index": 0
},
{
"name": "field",
"type": "string",
"multiple": true
}
]
}
}
{
"HELLO": {
"summary": "Handshake with Redis",
"complexity": "O(1)",
"group": "connection",
"since": "6.0.0",
"arity": -1,
"function": "helloCommand",
"history": [
[
"6.2",
"`protover` made optional; when called without arguments the command reports the current connection's context."
]
],
"command_flags": [
"NOSCRIPT",
"LOADING",
"STALE",
"FAST",
"NO_AUTH",
"SENTINEL"
],
"acl_categories": [
"CONNECTION"
],
"arguments": [
{
"name": "arguments",
"type": "block",
"optional": true,
"arguments": [
{
"name": "protover",
"type": "integer"
},
{
"token": "AUTH",
"name": "username_password",
"type": "block",
"optional": true,
"arguments": [
{
"name": "username",
"type": "string"
},
{
"name": "password",
"type": "string"
}
]
},
{
"token": "SETNAME",
"name": "clientname",
"type": "string",
"optional": true
}
]
}
]
}
}
{
"HEXISTS": {
"summary": "Determine if a hash field exists",
"complexity": "O(1)",
"group": "hash",
"since": "2.0.0",
"arity": 3,
"function": "hexistsCommand",
"command_flags": [
"READONLY",
"FAST"
],
"acl_categories": [
"HASH"
],
"key_specs": [
{
"flags": [
"READ"
],
"begin_search": {
"index": {
"pos": 1
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
}
],
"arguments": [
{
"name": "key",
"type": "key",
"key_spec_index": 0
},
{
"name": "field",
"type": "string"
}
]
}
}
{
"HGET": {
"summary": "Get the value of a hash field",
"complexity": "O(1)",
"group": "hash",
"since": "2.0.0",
"arity": 3,
"function": "hgetCommand",
"command_flags": [
"READONLY",
"FAST"
],
"acl_categories": [
"HASH"
],
"key_specs": [
{
"flags": [
"READ"
],
"begin_search": {
"index": {
"pos": 1
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
}
],
"arguments": [
{
"name": "key",
"type": "key",
"key_spec_index": 0
},
{
"name": "field",
"type": "string"
}
]
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment