Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Move complexity to commands.json.

  • Loading branch information...
commit 441c1c5ff9365ac88443f2c6b6f079e39d7d825c 1 parent 61926bb
@soveran soveran authored
Showing with 107 additions and 542 deletions.
  1. +4 −12 README.md
  2. +100 −0 commands.json
  3. +0 −7 commands/append.md
  4. +0 −2  commands/auth.md
  5. +0 −5 commands/blpop.md
  6. +0 −5 commands/brpop.md
  7. +0 −4 commands/brpoplpush.md
  8. +0 −6 commands/config get.md
  9. +0 −4 commands/config resetstat.md
  10. +0 −6 commands/config set.md
  11. +0 −5 commands/decr.md
  12. +0 −5 commands/decrby.md
  13. +0 −7 commands/del.md
  14. +0 −2  commands/echo.md
  15. +0 −5 commands/eval.md
  16. +0 −5 commands/exists.md
  17. +0 −5 commands/expire.md
  18. +0 −5 commands/expireat.md
  19. +0 −2  commands/flushall.md
  20. +0 −2  commands/flushdb.md
  21. +0 −5 commands/get.md
  22. +0 −5 commands/getbit.md
  23. +0 −6 commands/getrange.md
  24. +0 −5 commands/getset.md
  25. +0 −5 commands/hdel.md
  26. +0 −5 commands/hexists.md
  27. +0 −5 commands/hget.md
  28. +0 −4 commands/hgetall.md
  29. +0 −5 commands/hincrby.md
  30. +0 −4 commands/hkeys.md
  31. +0 −5 commands/hlen.md
  32. +0 −4 commands/hmget.md
  33. +0 −4 commands/hmset.md
  34. +0 −5 commands/hset.md
  35. +0 −5 commands/hsetnx.md
  36. +0 −4 commands/hvals.md
  37. +0 −5 commands/incr.md
  38. +0 −5 commands/incrby.md
  39. +0 −5 commands/keys.md
  40. +0 −2  commands/lastsave.md
  41. +0 −6 commands/lindex.md
  42. +0 −6 commands/linsert.md
  43. +0 −5 commands/llen.md
  44. +0 −5 commands/lpop.md
  45. +0 −5 commands/lpush.md
  46. +0 −5 commands/lpushx.md
  47. +0 −5 commands/lrange.md
  48. +0 −4 commands/lrem.md
  49. +0 −5 commands/lset.md
  50. +0 −4 commands/ltrim.md
  51. +0 −5 commands/mget.md
  52. +1 −3 commands/monitor.md
  53. +0 −5 commands/move.md
  54. +0 −5 commands/mset.md
  55. +0 −5 commands/msetnx.md
  56. +0 −4 commands/object.md
  57. +0 −5 commands/persist.md
  58. +0 −2  commands/ping.md
  59. +0 −4 commands/psubscribe.md
  60. +0 −6 commands/publish.md
  61. +0 −6 commands/punsubscribe.md
  62. +0 −2  commands/quit.md
  63. +0 −5 commands/randomkey.md
  64. +0 −5 commands/rename.md
  65. +0 −5 commands/renamenx.md
  66. +0 −5 commands/rpop.md
  67. +0 −5 commands/rpoplpush.md
  68. +0 −5 commands/rpush.md
  69. +0 −5 commands/rpushx.md
  70. +0 −5 commands/sadd.md
  71. +1 −5 commands/save.md
  72. +0 −5 commands/scard.md
  73. +0 −4 commands/sdiff.md
  74. +0 −4 commands/sdiffstore.md
  75. +0 −2  commands/select.md
  76. +0 −5 commands/set.md
  77. +0 −5 commands/setbit.md
  78. +0 −5 commands/setex.md
  79. +0 −5 commands/setnx.md
  80. +0 −6 commands/setrange.md
  81. +0 −5 commands/sinter.md
  82. +0 −5 commands/sinterstore.md
  83. +0 −5 commands/sismember.md
  84. +0 −4 commands/smembers.md
  85. +0 −5 commands/smove.md
  86. +0 −4 commands/sort.md
  87. +0 −5 commands/spop.md
  88. +0 −5 commands/srandmember.md
  89. +0 −5 commands/srem.md
  90. +0 −5 commands/strlen.md
  91. +0 −4 commands/subscribe.md
  92. +0 −4 commands/sunion.md
  93. +0 −4 commands/sunionstore.md
  94. +1 −5 commands/sync.md
  95. +0 −5 commands/ttl.md
  96. +0 −5 commands/type.md
  97. +0 −4 commands/unsubscribe.md
  98. +0 −4 commands/unwatch.md
  99. +0 −4 commands/watch.md
  100. +0 −4 commands/zadd.md
  101. +0 −5 commands/zcard.md
  102. +0 −5 commands/zcount.md
  103. +0 −4 commands/zincrby.md
  104. +0 −6 commands/zinterstore.md
  105. +0 −5 commands/zrange.md
  106. +0 −6 commands/zrangebyscore.md
  107. +0 −5 commands/zrank.md
  108. +0 −4 commands/zrem.md
  109. +0 −5 commands/zremrangebyrank.md
  110. +0 −5 commands/zremrangebyscore.md
  111. +0 −5 commands/zrevrange.md
  112. +0 −6 commands/zrevrangebyscore.md
  113. +0 −5 commands/zrevrank.md
  114. +0 −5 commands/zscore.md
  115. +0 −5 commands/zunionstore.md
View
16 README.md
@@ -49,20 +49,12 @@ backticks. For example: <code>`INCR`</code>.
example: `@multi-bulk-reply`. These keywords will get expanded and
auto-linked to relevant parts of the documentation.
-There should be at least three predefined sections: time complexity,
-description and return value. These sections are marked using magic
-keywords, too:
-
- @complexity
-
- O(n), where N is the number of keys in the database.
-
-
- @description
+There should be at least two predefined sections: description and
+return value. The return value section is marked using the @return
+keyword:
Returns all keys matching the given pattern.
-
@return
@multi-bulk-reply: all the keys that matched the pattern.
@@ -82,7 +74,7 @@ Once you're done, the very least you should do is make sure that all
files compile properly. You can do this by running Rake inside your
working directory.
- $ rake
+ $ rake parse
Additionally, if you have [Aspell](http://aspell.net/) installed, you
can spell check the documentation:
View
100 commands.json
@@ -1,6 +1,7 @@
{
"APPEND": {
"summary": "Append a value to a key",
+ "complexity": "O(1). The amortized time complexity is O(1) assuming the appended value is small and the already present value is of any size, since the dynamic string library used by Redis will double the free space available on every reallocation.",
"arguments": [
{
"name": "key",
@@ -37,6 +38,7 @@
},
"BLPOP": {
"summary": "Remove and get the first element in a list, or block until one is available",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -53,6 +55,7 @@
},
"BRPOP": {
"summary": "Remove and get the last element in a list, or block until one is available",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -69,6 +72,7 @@
},
"BRPOPLPUSH": {
"summary": "Pop a value from a list, push it to another list and return it; or block until one is available",
+ "complexity": "O(1)",
"arguments": [
{
"name": "source",
@@ -114,6 +118,7 @@
},
"CONFIG RESETSTAT": {
"summary": "Reset the stats returned by INFO",
+ "complexity": "O(1)",
"since": "2.0",
"group": "server"
},
@@ -140,6 +145,7 @@
},
"DECR": {
"summary": "Decrement the integer value of a key by one",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -151,6 +157,7 @@
},
"DECRBY": {
"summary": "Decrement the integer value of a key by the given number",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -166,6 +173,7 @@
},
"DEL": {
"summary": "Delete a key",
+ "complexity": "O(N) where N is the number of keys that will be removed. When a key to remove holds a value other than a string, the individual complexity for this key is O(M) where M is the number of elements in the list, set, sorted set or hash. Removing a single key that holds a string value is O(1).",
"arguments": [
{
"name": "key",
@@ -199,6 +207,7 @@
},
"EXISTS": {
"summary": "Determine if a key exists",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -210,6 +219,7 @@
},
"EXPIRE": {
"summary": "Set a key's time to live in seconds",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -225,6 +235,7 @@
},
"EXPIREAT": {
"summary": "Set the expiration for a key as a UNIX timestamp",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -250,6 +261,7 @@
},
"GET": {
"summary": "Get the value of a key",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -261,6 +273,7 @@
},
"GETBIT": {
"summary": "Returns the bit value at offset in the string value stored at key",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -276,6 +289,7 @@
},
"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.",
"arguments": [
{
"name": "key",
@@ -295,6 +309,7 @@
},
"GETSET": {
"summary": "Set the string value of a key and return its old value",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -310,6 +325,7 @@
},
"HDEL": {
"summary": "Delete one or more hash fields",
+ "complexity": "O(N) where N is the number of fields to be removed.",
"arguments": [
{
"name": "key",
@@ -326,6 +342,7 @@
},
"HEXISTS": {
"summary": "Determine if a hash field exists",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -341,6 +358,7 @@
},
"HGET": {
"summary": "Get the value of a hash field",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -356,6 +374,7 @@
},
"HGETALL": {
"summary": "Get all the fields and values in a hash",
+ "complexity": "O(N) where N is the size of the hash.",
"arguments": [
{
"name": "key",
@@ -367,6 +386,7 @@
},
"HINCRBY": {
"summary": "Increment the integer value of a hash field by the given number",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -386,6 +406,7 @@
},
"HKEYS": {
"summary": "Get all the fields in a hash",
+ "complexity": "O(N) where N is the size of the hash.",
"arguments": [
{
"name": "key",
@@ -397,6 +418,7 @@
},
"HLEN": {
"summary": "Get the number of fields in a hash",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -408,6 +430,7 @@
},
"HMGET": {
"summary": "Get the values of all the given hash fields",
+ "complexity": "O(N) where N is the number of fields being requested.",
"arguments": [
{
"name": "key",
@@ -424,6 +447,7 @@
},
"HMSET": {
"summary": "Set multiple hash fields to multiple values",
+ "complexity": "O(N) where N is the number of fields being set.",
"arguments": [
{
"name": "key",
@@ -440,6 +464,7 @@
},
"HSET": {
"summary": "Set the string value of a hash field",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -459,6 +484,7 @@
},
"HSETNX": {
"summary": "Set the value of a hash field, only if the field does not exist",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -478,6 +504,7 @@
},
"HVALS": {
"summary": "Get all the values in a hash",
+ "complexity": "O(N) where N is the size of the hash.",
"arguments": [
{
"name": "key",
@@ -489,6 +516,7 @@
},
"INCR": {
"summary": "Increment the integer value of a key by one",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -500,6 +528,7 @@
},
"INCRBY": {
"summary": "Increment the integer value of a key by the given number",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -520,6 +549,7 @@
},
"KEYS": {
"summary": "Find all keys matching the given pattern",
+ "complexity": "O(N) with N being the number of keys in the database, under the assumption that the key names in the database and the given pattern have limited length.",
"arguments": [
{
"name": "pattern",
@@ -536,6 +566,7 @@
},
"LINDEX": {
"summary": "Get an element from a list by its index",
+ "complexity": "O(N) where N is the number of elements to traverse to get to the element at `index`. This makes asking for the first or the last element of the list O(1).",
"arguments": [
{
"name": "key",
@@ -551,6 +582,7 @@
},
"LINSERT": {
"summary": "Insert an element before or after another element in a list",
+ "complexity": "O(N) where N is the number of elements to traverse before seeing the value `pivot`. This means that inserting somewhere on the left end on the list (head) can be considered O(1) and inserting somewhere on the right end (tail) is O(N).",
"arguments": [
{
"name": "key",
@@ -575,6 +607,7 @@
},
"LLEN": {
"summary": "Get the length of a list",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -586,6 +619,7 @@
},
"LPOP": {
"summary": "Remove and get the first element in a list",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -597,6 +631,7 @@
},
"LPUSH": {
"summary": "Prepend one or multiple values to a list",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -613,6 +648,7 @@
},
"LPUSHX": {
"summary": "Prepend a value to a list, only if the list exists",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -628,6 +664,7 @@
},
"LRANGE": {
"summary": "Get a range of elements from a list",
+ "complexity": "O(S+N) where S is the `start` offset and N is the number of elements in the specified range.",
"arguments": [
{
"name": "key",
@@ -647,6 +684,7 @@
},
"LREM": {
"summary": "Remove elements from a list",
+ "complexity": "O(N) where N is the length of the list.",
"arguments": [
{
"name": "key",
@@ -666,6 +704,7 @@
},
"LSET": {
"summary": "Set the value of an element in a list by its index",
+ "complexity": "O(N) where N is the length of the list. Setting either the first or the last element of the list is O(1).",
"arguments": [
{
"name": "key",
@@ -685,6 +724,7 @@
},
"LTRIM": {
"summary": "Trim a list to the specified range",
+ "complexity": "O(N) where N is the number of elements to be removed by the operation.",
"arguments": [
{
"name": "key",
@@ -704,6 +744,7 @@
},
"MGET": {
"summary": "Get the values of all the given keys",
+ "complexity": "O(N) where N is the number of keys to retrieve.",
"arguments": [
{
"name": "key",
@@ -721,6 +762,7 @@
},
"MOVE": {
"summary": "Move a key to another database",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -736,6 +778,7 @@
},
"MSET": {
"summary": "Set multiple keys to multiple values",
+ "complexity": "O(N) where N is the number of keys to set.",
"arguments": [
{
"name": ["key", "value"],
@@ -748,6 +791,7 @@
},
"MSETNX": {
"summary": "Set multiple keys to multiple values, only if none of the keys exist",
+ "complexity": "O(N) where N is the number of keys to set.",
"arguments": [
{
"name": ["key", "value"],
@@ -765,6 +809,7 @@
},
"OBJECT": {
"summary": "Inspect the internals of Redis objects",
+ "complexity": "O(1) for all the currently implemented subcommands.",
"since": "2.2.3",
"group": "generic",
"arguments": [
@@ -782,6 +827,7 @@
},
"PERSIST": {
"summary": "Remove the expiration from a key",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -798,6 +844,7 @@
},
"PSUBSCRIBE": {
"summary": "Listen for messages published to channels matching the given patterns",
+ "complexity": "O(N) where N is the number of patterns the client is already subscribed to.",
"arguments": [
{
"name": ["pattern"],
@@ -810,6 +857,7 @@
},
"PUBLISH": {
"summary": "Post a message to a channel",
+ "complexity": "O(N+M) where N is the number of clients subscribed to the receiving channel and M is the total number of subscribed patterns (by any client).",
"arguments": [
{
"name": "channel",
@@ -825,6 +873,7 @@
},
"PUNSUBSCRIBE": {
"summary": "Stop listening for messages posted to channels matching the given patterns",
+ "complexity": "O(N+M) where N is the number of patterns the client is already subscribed and M is the number of total patterns subscribed in the system (by any client).",
"arguments": [
{
"name": "pattern",
@@ -843,11 +892,13 @@
},
"RANDOMKEY": {
"summary": "Return a random key from the keyspace",
+ "complexity": "O(1)",
"since": "0.07",
"group": "generic"
},
"RENAME": {
"summary": "Rename a key",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -863,6 +914,7 @@
},
"RENAMENX": {
"summary": "Rename a key, only if the new key does not exist",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -878,6 +930,7 @@
},
"RPOP": {
"summary": "Remove and get the last element in a list",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -889,6 +942,7 @@
},
"RPOPLPUSH": {
"summary": "Remove the last element in a list, append it to another list and return it",
+ "complexity": "O(1)",
"arguments": [
{
"name": "source",
@@ -904,6 +958,7 @@
},
"RPUSH": {
"summary": "Append one or multiple values to a list",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -920,6 +975,7 @@
},
"RPUSHX": {
"summary": "Append a value to a list, only if the list exists",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -935,6 +991,7 @@
},
"SADD": {
"summary": "Add one or more members to a set",
+ "complexity": "O(N) where N is the number of members to be added.",
"arguments": [
{
"name": "key",
@@ -956,6 +1013,7 @@
},
"SCARD": {
"summary": "Get the number of members in a set",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -967,6 +1025,7 @@
},
"SDIFF": {
"summary": "Subtract multiple sets",
+ "complexity": "O(N) where N is the total number of elements in all given sets.",
"arguments": [
{
"name": "key",
@@ -979,6 +1038,7 @@
},
"SDIFFSTORE": {
"summary": "Subtract multiple sets and store the resulting set in a key",
+ "complexity": "O(N) where N is the total number of elements in all given sets.",
"arguments": [
{
"name": "destination",
@@ -1006,6 +1066,7 @@
},
"SET": {
"summary": "Set the string value of a key",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -1021,6 +1082,7 @@
},
"SETBIT": {
"summary": "Sets or clears the bit at offset in the string value stored at key",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -1040,6 +1102,7 @@
},
"SETEX": {
"summary": "Set the value and expiration of a key",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -1059,6 +1122,7 @@
},
"SETNX": {
"summary": "Set the value of a key, only if the key does not exist",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -1074,6 +1138,7 @@
},
"SETRANGE": {
"summary": "Overwrite part of a string at key starting at the specified offset",
+ "complexity": "O(1), not counting the time taken to copy the new string in place. Usually, this string is very small so the amortized complexity is O(1). Otherwise, complexity is O(M) with M being the length of the `value` argument.",
"arguments": [
{
"name": "key",
@@ -1098,6 +1163,7 @@
},
"SINTER": {
"summary": "Intersect multiple sets",
+ "complexity": "O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets.",
"arguments": [
{
"name": "key",
@@ -1110,6 +1176,7 @@
},
"SINTERSTORE": {
"summary": "Intersect multiple sets and store the resulting set in a key",
+ "complexity": "O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets.",
"arguments": [
{
"name": "destination",
@@ -1126,6 +1193,7 @@
},
"SISMEMBER": {
"summary": "Determine if a given value is a member of a set",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -1172,6 +1240,7 @@
},
"SMEMBERS": {
"summary": "Get all the members in a set",
+ "complexity": "O(N) where N is the set cardinality.",
"arguments": [
{
"name": "key",
@@ -1183,6 +1252,7 @@
},
"SMOVE": {
"summary": "Move a member from one set to another",
+ "complexity": "O(1)",
"arguments": [
{
"name": "source",
@@ -1202,6 +1272,7 @@
},
"SORT": {
"summary": "Sort the elements in a list, set or sorted set",
+ "complexity": "O(N+M*log(M)) where N is the number of elements in the list or set to sort, and M the number of returned elements. When the elements are not sorted, complexity is currently O(N) as there is a copy step that will be avoided in next releases.",
"arguments": [
{
"name": "key",
@@ -1250,6 +1321,7 @@
},
"SPOP": {
"summary": "Remove and return a random member from a set",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -1261,6 +1333,7 @@
},
"SRANDMEMBER": {
"summary": "Get a random member from a set",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -1272,6 +1345,7 @@
},
"SREM": {
"summary": "Remove one or more members from a set",
+ "complexity": "O(N) where N is the number of members to be removed.",
"arguments": [
{
"name": "key",
@@ -1288,6 +1362,7 @@
},
"STRLEN": {
"summary": "Get the length of the value stored in a key",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -1299,6 +1374,7 @@
},
"SUBSCRIBE": {
"summary": "Listen for messages published to the given channels",
+ "complexity": "O(N) where N is the number of channels to subscribe to.",
"arguments": [
{
"name": ["channel"],
@@ -1311,6 +1387,7 @@
},
"SUNION": {
"summary": "Add multiple sets",
+ "complexity": "O(N) where N is the total number of elements in all given sets.",
"arguments": [
{
"name": "key",
@@ -1323,6 +1400,7 @@
},
"SUNIONSTORE": {
"summary": "Add multiple sets and store the resulting set in a key",
+ "complexity": "O(N) where N is the total number of elements in all given sets.",
"arguments": [
{
"name": "destination",
@@ -1344,6 +1422,7 @@
},
"TTL": {
"summary": "Get the time to live for a key",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -1355,6 +1434,7 @@
},
"TYPE": {
"summary": "Determine the type stored at key",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -1366,6 +1446,7 @@
},
"UNSUBSCRIBE": {
"summary": "Stop listening for messages posted to the given channels",
+ "complexity": "O(N) where N is the number of clients already subscribed to a channel.",
"arguments": [
{
"name": "channel",
@@ -1379,11 +1460,13 @@
},
"UNWATCH": {
"summary": "Forget about all watched keys",
+ "complexity": "O(1)",
"since": "2.1.0",
"group": "transactions"
},
"WATCH": {
"summary": "Watch the given keys to determine execution of the MULTI/EXEC block",
+ "complexity": "O(1) for every key.",
"arguments": [
{
"name": "key",
@@ -1396,6 +1479,7 @@
},
"ZADD": {
"summary": "Add one or more members to a sorted set, or update its score if it already exists",
+ "complexity": "O(log(N)) where N is the number of elements in the sorted set.",
"arguments": [
{
"name": "key",
@@ -1425,6 +1509,7 @@
},
"ZCARD": {
"summary": "Get the number of members in a sorted set",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -1436,6 +1521,7 @@
},
"ZCOUNT": {
"summary": "Count the members in a sorted set with scores within the given values",
+ "complexity": "O(log(N)+M) with N being the number of elements in the sorted set and M being the number of elements between `min` and `max`.",
"arguments": [
{
"name": "key",
@@ -1455,6 +1541,7 @@
},
"ZINCRBY": {
"summary": "Increment the score of a member in a sorted set",
+ "complexity": "O(log(N)) where N is the number of elements in the sorted set.",
"arguments": [
{
"name": "key",
@@ -1474,6 +1561,7 @@
},
"ZINTERSTORE": {
"summary": "Intersect multiple sorted sets and store the resulting sorted set in a new key",
+ "complexity": "O(N*K)+O(M*log(M)) worst case with N being the smallest input sorted set, K being the number of input sorted sets and M being the number of elements in the resulting sorted set.",
"arguments": [
{
"name": "destination",
@@ -1508,6 +1596,7 @@
},
"ZRANGE": {
"summary": "Return a range of members in a sorted set, by index",
+ "complexity": "O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements returned.",
"arguments": [
{
"name": "key",
@@ -1533,6 +1622,7 @@
},
"ZRANGEBYSCORE": {
"summary": "Return a range of members in a sorted set, by score",
+ "complexity": "O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned. If M is constant (e.g. always asking for the first 10 elements with `LIMIT`), you can consider it O(log(N)).",
"arguments": [
{
"name": "key",
@@ -1564,6 +1654,7 @@
},
"ZRANK": {
"summary": "Determine the index of a member in a sorted set",
+ "complexity": "O(log(N))",
"arguments": [
{
"name": "key",
@@ -1579,6 +1670,7 @@
},
"ZREM": {
"summary": "Remove one or more members from a sorted set",
+ "complexity": "O(M*log(N)) with N being the number of elements in the sorted set and M the number of elements to be removed.",
"arguments": [
{
"name": "key",
@@ -1595,6 +1687,7 @@
},
"ZREMRANGEBYRANK": {
"summary": "Remove all members in a sorted set within the given indexes",
+ "complexity": "O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements removed by the operation.",
"arguments": [
{
"name": "key",
@@ -1614,6 +1707,7 @@
},
"ZREMRANGEBYSCORE": {
"summary": "Remove all members in a sorted set within the given scores",
+ "complexity": "O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements removed by the operation.",
"arguments": [
{
"name": "key",
@@ -1633,6 +1727,7 @@
},
"ZREVRANGE": {
"summary": "Return a range of members in a sorted set, by index, with scores ordered from high to low",
+ "complexity": "O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements returned.",
"arguments": [
{
"name": "key",
@@ -1658,6 +1753,7 @@
},
"ZREVRANGEBYSCORE": {
"summary": "Return a range of members in a sorted set, by score, with scores ordered from high to low",
+ "complexity": "O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned. If M is constant (e.g. always asking for the first 10 elements with `LIMIT`), you can consider it O(log(N)).",
"arguments": [
{
"name": "key",
@@ -1689,6 +1785,7 @@
},
"ZREVRANK": {
"summary": "Determine the index of a member in a sorted set, with scores ordered from high to low",
+ "complexity": "O(log(N))",
"arguments": [
{
"name": "key",
@@ -1704,6 +1801,7 @@
},
"ZSCORE": {
"summary": "Get the score associated with the given member in a sorted set",
+ "complexity": "O(1)",
"arguments": [
{
"name": "key",
@@ -1719,6 +1817,7 @@
},
"ZUNIONSTORE": {
"summary": "Add multiple sorted sets and store the resulting sorted set in a new key",
+ "complexity": "O(N)+O(M log(M)) with N being the sum of the sizes of the input sorted sets, and M being the number of elements in the resulting sorted set.",
"arguments": [
{
"name": "destination",
@@ -1753,6 +1852,7 @@
},
"EVAL": {
"summary": "Execute a Lua script server side",
+ "complexity": "Looking up the script both with `EVAL` or `EVALSHA` is an O(1) business. The additional complexity is up to the script you execute.",
"arguments": [
{
"name": "script",
View
7 commands/append.md
@@ -1,10 +1,3 @@
-@complexity
-
-O(1). The amortized time complexity is O(1) assuming the appended value is
-small and the already present value is of any size, since the dynamic string
-library used by Redis will double the free space available on every
-reallocation.
-
If `key` already exists and is a string, this command appends the `value` at
the end of the string. If `key` does not exist it is created and set as an
empty string, so `APPEND` will be similar to `SET` in this special case.
View
2  commands/auth.md
@@ -1,5 +1,3 @@
-@description
-
Request for authentication in a password protected Redis server.
Redis can be instructed to require a password before allowing clients
to execute commands. This is done using the `requirepass` directive in the
View
5 commands/blpop.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
`BLPOP` is a blocking list pop primitive. It is the blocking version of `LPOP`
because it blocks the connection when there are no elements to pop from any of
the given lists. An element is popped from the head of the first list that is
View
5 commands/brpop.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
`BRPOP` is a blocking list pop primitive. It is the blocking version of
[RPOP](/commands/rpop) because it blocks the connection when there are no
elements to pop from any of the given lists. An element is popped from the
View
4 commands/brpoplpush.md
@@ -1,7 +1,3 @@
-@complexity
-
-O(1).
-
`BRPOPLPUSH` is the blocking variant of [RPOPLPUSH](/commands/rpoplpush).
When `source` contains elements, this command behaves exactly like
[RPOPLPUSH](/commands/rpoplpush). When `source` is empty, Redis will block
View
6 commands/config get.md
@@ -1,9 +1,3 @@
-@complexity
-
-Not applicable.
-
-@description
-
The `CONFIG GET` command is used to read the configuration parameters of a
running Redis server. Not all the configuration parameters are
supported in Redis 2.4, while Redis 2.6 can read the whole configuration of
View
4 commands/config resetstat.md
@@ -1,7 +1,3 @@
-@complexity
-
-O(1).
-
Resets the statistics reported by Redis using the [INFO](/commands/info) command.
These are the counters that are reset:
View
6 commands/config set.md
@@ -1,9 +1,3 @@
-@complexity
-
-Not applicable.
-
-@description
-
The `CONFIG SET` command is used in order to reconfigure the server at runtime
without the need to restart Redis. You can change both trivial parameters or
switch from one to another persistence option using this command.
View
5 commands/decr.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Decrements the number stored at `key` by one.
If the key does not exist, it is set to `0` before performing the operation. An
error is returned if the key contains a value of the wrong type or contains a
View
5 commands/decrby.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Decrements the number stored at `key` by `decrement`.
If the key does not exist, it is set to `0` before performing the operation. An
error is returned if the key contains a value of the wrong type or contains a
View
7 commands/del.md
@@ -1,10 +1,3 @@
-@complexity
-
-O(N) where N is the number of keys that will be removed. When a key to remove
-holds a value other than a string, the individual complexity for this key is
-O(M) where M is the number of elements in the list, set, sorted set or hash.
-Removing a single key that holds a string value is O(1).
-
Removes the specified keys. A key is ignored if it does not exist.
@return
View
2  commands/echo.md
@@ -1,5 +1,3 @@
-@description
-
Returns `message`.
@return
View
5 commands/eval.md
@@ -1,8 +1,3 @@
-@complexity
-
-Looking up the script both with `EVAL` or `EVALSHA` is an O(1) business. The
-additional complexity is up to the script you execute.
-
Warning
---
View
5 commands/exists.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Returns if `key` exists.
@return
View
5 commands/expire.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Set a timeout on `key`. After the timeout has expired, the key will
automatically be deleted. A key with an associated timeout is often said to be
_volatile_ in Redis terminology.
View
5 commands/expireat.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
`EXPIREAT` has the same effect and semantic as [EXPIRE](/commands/expire), but
instead of specifying the number of seconds representing the TTL (time to live), it takes an absolute [UNIX timestamp][2] (seconds since January 1, 1970).
View
2  commands/flushall.md
@@ -1,5 +1,3 @@
-
-
Delete all the keys of all the existing databases, not just the currently selected one. This command never fails.
@return
View
2  commands/flushdb.md
@@ -1,5 +1,3 @@
-
-
Delete all the keys of the currently selected DB. This command never fails.
@return
View
5 commands/get.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Get the value of `key`. If the key does not exist the special value `nil` is returned.
An error is returned if the value stored at `key` is not a string, because `GET`
only handles string values.
View
5 commands/getbit.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Returns the bit value at _offset_ in the string value stored at _key_.
When _offset_ is beyond the string length, the string is assumed to be a
View
6 commands/getrange.md
@@ -1,9 +1,3 @@
-@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.
-
**Warning**: this command was renamed to `GETRANGE`, it is called `SUBSTR` in Redis versions `<= 2.0`.
Returns the substring of the string value stored at `key`, determined by the
View
5 commands/getset.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Atomically sets `key` to `value` and returns the old value stored at `key`.
Returns an error when `key` exists but does not hold a string value.
View
5 commands/hdel.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(N) where N is the number of fields to be removed.
-
-
Removes the specified fields from the hash stored at `key`. Specified fields
that do not exist within this hash are ignored.
If `key` does not exist, it is treated as an empty hash and this command returns
View
5 commands/hexists.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Returns if `field` is an existing field in the hash stored at `key`.
@return
View
5 commands/hget.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Returns the value associated with `field` in the hash stored at `key`.
@return
View
4 commands/hgetall.md
@@ -1,7 +1,3 @@
-@complexity
-
-O(N) where N is the size of the hash.
-
Returns all fields and values of the hash stored at `key`. In the returned
value, every field name is followed by its value, so the length
of the reply is twice the size of the hash.
View
5 commands/hincrby.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Increments the number stored at `field` in the hash stored at `key` by
`increment`. If `key` does not exist, a new key holding a hash is created. If
`field` does not exist the value is set to `0` before the operation is
View
4 commands/hkeys.md
@@ -1,7 +1,3 @@
-@complexity
-
-O(N) where N is the size of the hash.
-
Returns all field names in the hash stored at `key`.
@return
View
5 commands/hlen.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Returns the number of fields contained in the hash stored at `key`.
@return
View
4 commands/hmget.md
@@ -1,7 +1,3 @@
-@complexity
-
-O(N) where N is the number of fields being requested.
-
Returns the values associated with the specified `fields` in the hash stored at
`key`.
View
4 commands/hmset.md
@@ -1,7 +1,3 @@
-@complexity
-
-O(N) where N is the number of fields being set.
-
Sets the specified fields to their respective values in the hash
stored at `key`. This command overwrites any existing fields in the hash.
If `key` does not exist, a new key holding a hash is created.
View
5 commands/hset.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Sets `field` in the hash stored at `key` to `value`. If `key` does not exist, a
new key holding a hash is created. If `field` already exists in the hash, it
is overwritten.
View
5 commands/hsetnx.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Sets `field` in the hash stored at `key` to `value`, only if `field` does not
yet exist. If `key` does not exist, a new key holding a hash is created. If
`field` already exists, this operation has no effect.
View
4 commands/hvals.md
@@ -1,7 +1,3 @@
-@complexity
-
-O(N) where N is the size of the hash.
-
Returns all values in the hash stored at `key`.
@return
View
5 commands/incr.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Increments the number stored at `key` by one.
If the key does not exist, it is set to `0` before performing the operation. An
error is returned if the key contains a value of the wrong type or contains a
View
5 commands/incrby.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Increments the number stored at `key` by `increment`.
If the key does not exist, it is set to `0` before performing the operation. An
error is returned if the key contains a value of the wrong type or contains a
View
5 commands/keys.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(N) with N being the number of keys in the database, under the assumption that
-the key names in the database and the given pattern have limited length.
-
Returns all keys matching `pattern`.
While the time complexity for this operation is O(N), the constant
View
2  commands/lastsave.md
@@ -1,5 +1,3 @@
-
-
Return the UNIX TIME of the last DB save executed with success.
A client may check if a `BGSAVE` command succeeded reading the `LASTSAVE`
value, then issuing a `BGSAVE` command and checking at regular intervals
View
6 commands/lindex.md
@@ -1,9 +1,3 @@
-@complexity
-
-O(N) where N is the number of elements to traverse to get to the element
-at `index`. This makes asking for the first or the last
-element of the list O(1).
-
Returns the element at index `index` in the list stored at `key`.
The index is zero-based, so `0` means the first element, `1` the second
element and so on. Negative indices can be used to designate elements
View
6 commands/linsert.md
@@ -1,9 +1,3 @@
-@complexity
-
-O(N) where N is the number of elements to traverse before seeing the value
-`pivot`. This means that inserting somewhere on the left end on the list (head)
-can be considered O(1) and inserting somewhere on the right end (tail) is O(N).
-
Inserts `value` in the list stored at `key` either before or after the
reference value `pivot`.
View
5 commands/llen.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Returns the length of the list stored at `key`.
If `key` does not exist, it is interpreted as an empty list and `0` is returned.
An error is returned when the value stored at `key` is not a list.
View
5 commands/lpop.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Removes and returns the first element of the list stored at `key`.
@return
View
5 commands/lpush.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Insert all the specified values at the head of the list stored at `key`.
If `key` does not exist, it is created as empty list before performing
the push operations.
View
5 commands/lpushx.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Inserts `value` at the head of the list stored at `key`, only if `key`
already exists and holds a list. In contrary to `LPUSH`, no operation will
be performed when `key` does not yet exist.
View
5 commands/lrange.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(S+N) where S is the `start` offset and N is the number of elements in the
-specified range.
-
Returns the specified elements of the list stored at `key`. The offsets
`start` and `stop` are zero-based indexes, with `0` being the first element of
the list (the head of the list), `1` being the next element and so on.
View
4 commands/lrem.md
@@ -1,7 +1,3 @@
-@complexity
-
-O(N) where N is the length of the list.
-
Removes the first `count` occurrences of elements equal to `value` from the
list stored at `key`. The `count` argument influences the operation in the
following ways:
View
5 commands/lset.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(N) where N is the length of the list. Setting either the first or the last
-element of the list is O(1).
-
Sets the list element at `index` to `value`. For more information on the
`index` argument, see `LINDEX`.
View
4 commands/ltrim.md
@@ -1,7 +1,3 @@
-@complexity
-
-O(N) where N is the number of elements to be removed by the operation.
-
Trim an existing list so that it will contain only the specified range of
elements specified. Both `start` and `stop` are zero-based indexes, where `0`
is the first element of the list (the head), `1` the next element and so on.
View
5 commands/mget.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(N) where N is the number of keys to retrieve
-
-
Returns the values of all specified keys. For every key that does not hold a string value
or does not exist, the special value `nil` is returned.
Because of this, the operation never fails.
View
4 commands/monitor.md
@@ -1,5 +1,3 @@
-
-
`MONITOR` is a debugging command that outputs the whole sequence of commands
received by the Redis server. is very handy in order to understand
what is happening into the database. This command is used directly
@@ -35,4 +33,4 @@ In order to end a monitoring session just issue a `QUIT` command by hand.
@return
**Non standard return value**, just dumps the received commands in an infinite
-flow.
+flow.
View
5 commands/move.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Move `key` from the currently selected database (see `SELECT`) to the specified
destination database. When `key` already exists in the destination database, or
it does not exist in the source database, it does nothing. It is possible to
View
5 commands/mset.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(N) where N is the number of keys to set
-
-
Sets the given keys to their respective values. `MSET` replaces existing values
with new values, just as regular `SET`. See `MSETNX` if you don't want to
overwrite existing values.
View
5 commands/msetnx.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(N) where N is the number of keys to set
-
-
Sets the given keys to their respective values. `MSETNX` will not perform any
operation at all even if just a single key already exists.
View
4 commands/object.md
@@ -1,7 +1,3 @@
-@complexity
-
-O(1) for all the currently implemented subcommands.
-
The `OBJECT` command allows to inspect the internals of Redis Objects associated
with keys. It is useful for debugging or to understand if your keys are using
the specially encoded data types to save space. Your application may also use
View
5 commands/persist.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Remove the existing timeout on `key`, turning the key from _volatile_ (a key with an expire set) to _persistent_ (a key that will never expire as no timeout is associated).
@return
View
2  commands/ping.md
@@ -1,5 +1,3 @@
-@description
-
Returns `PONG`. This command is often used to test if a connection is still
alive, or to measure latency.
View
4 commands/psubscribe.md
@@ -1,5 +1 @@
-@complexity
-
-O(N) where N is the number of patterns the client is already subscribed to.
-
Subscribes the client to the given patterns.
View
6 commands/publish.md
@@ -1,9 +1,3 @@
-@complexity
-
-O(N+M) where N is the number of clients subscribed to the receiving
-channel and M is the total number of subscribed patterns (by any
-client).
-
Posts a message to the given channel.
@return
View
6 commands/punsubscribe.md
@@ -1,9 +1,3 @@
-@complexity
-
-O(N+M) where N is the number of patterns the client is already
-subscribed and M is the number of total patterns subscribed in the
-system (by any client).
-
Unsubscribes the client from the given patterns, or from all of them if
none is given.
View
2  commands/quit.md
@@ -1,5 +1,3 @@
-@description
-
Ask the server to close the connection. The connection is closed as soon as all
pending replies have been written to the client.
View
5 commands/randomkey.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Return a random key from the currently selected database.
@return
View
5 commands/rename.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Renames `key` to `newkey`. It returns an error when the source and destination
names are the same, or when `key` does not exist. If `newkey` already exists it
is overwritten.
View
5 commands/renamenx.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Renames `key` to `newkey` if `newkey` does not yet exist.
It returns an error under the same conditions as `RENAME`.
View
5 commands/rpop.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Removes and returns the last element of the list stored at `key`.
@return
View
5 commands/rpoplpush.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Atomically returns and removes the last element (tail) of the list stored at
`source`, and pushes the element at the first element (head) of the list stored
at `destination`.
View
5 commands/rpush.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Insert all the specified values at the tail of the list stored at `key`.
If `key` does not exist, it is created as empty list before performing the
push operation.
View
5 commands/rpushx.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Inserts `value` at the tail of the list stored at `key`, only if `key`
already exists and holds a list. In contrary to `RPUSH`, no operation will
be performed when `key` does not yet exist.
View
5 commands/sadd.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(N) where N is the number of members to be added.
-
-
Add the specified members to the set stored at `key`. Specified members that
are already a member of this set are ignored. If `key` does not exist, a new
set is created before adding the specified members.
View
6 commands/save.md
@@ -1,7 +1,3 @@
-@complexity
-
-@description
-
@examples
-@return
+@return
View
5 commands/scard.md
@@ -1,8 +1,3 @@
-@complexity
-
-O(1)
-
-
Returns the set cardinality (number of elements) of the set stored at `key`.
@return
View
4 commands/sdiff.md
@@ -1,7 +1,3 @@
-@complexity
-
-O(N) where N is the total number of elements in all given sets.
-
Returns the members of the set resulting from the difference between the first
set and all the successive sets.