From 8b5dcc1c112876066a5bcb93288abcdd8b088e94 Mon Sep 17 00:00:00 2001 From: Igor Chubin Date: Sat, 19 May 2018 20:40:36 +0000 Subject: [PATCH] added _redis/ --- sheets/_redis/_info.yaml | 0 sheets/_redis/cluster | 60 ++++++++++++++++++++++++ sheets/_redis/connection | 18 ++++++++ sheets/_redis/generic | 72 +++++++++++++++++++++++++++++ sheets/_redis/geo | 18 ++++++++ sheets/_redis/hash | 45 ++++++++++++++++++ sheets/_redis/hyperloglog | 9 ++++ sheets/_redis/list | 51 +++++++++++++++++++++ sheets/_redis/pubsub | 18 ++++++++ sheets/_redis/scripting | 21 +++++++++ sheets/_redis/server | 93 ++++++++++++++++++++++++++++++++++++++ sheets/_redis/set | 45 ++++++++++++++++++ sheets/_redis/sorted_set | 63 ++++++++++++++++++++++++++ sheets/_redis/string | 72 +++++++++++++++++++++++++++++ sheets/_redis/transactions | 15 ++++++ 15 files changed, 600 insertions(+) create mode 100644 sheets/_redis/_info.yaml create mode 100644 sheets/_redis/cluster create mode 100644 sheets/_redis/connection create mode 100644 sheets/_redis/generic create mode 100644 sheets/_redis/geo create mode 100644 sheets/_redis/hash create mode 100644 sheets/_redis/hyperloglog create mode 100644 sheets/_redis/list create mode 100644 sheets/_redis/pubsub create mode 100644 sheets/_redis/scripting create mode 100644 sheets/_redis/server create mode 100644 sheets/_redis/set create mode 100644 sheets/_redis/sorted_set create mode 100644 sheets/_redis/string create mode 100644 sheets/_redis/transactions diff --git a/sheets/_redis/_info.yaml b/sheets/_redis/_info.yaml new file mode 100644 index 0000000..e69de29 diff --git a/sheets/_redis/cluster b/sheets/_redis/cluster new file mode 100644 index 0000000..df884c4 --- /dev/null +++ b/sheets/_redis/cluster @@ -0,0 +1,60 @@ +# Assign new hash slots to receiving node +CLUSTER ADDSLOTS slot [slot ...] + +# Return the number of failure reports active for a given node +CLUSTER COUNT-FAILURE-REPORTS node-id + +# Return the number of local keys in the specified hash slot +CLUSTER COUNTKEYSINSLOT slot + +# Set hash slots as unbound in receiving node +CLUSTER DELSLOTS slot [slot ...] + +# Forces a slave to perform a manual failover of its master. +CLUSTER FAILOVER [FORCE|TAKEOVER] + +# Remove a node from the nodes table +CLUSTER FORGET node-id + +# Return local key names in the specified hash slot +CLUSTER GETKEYSINSLOT slot count + +# Provides info about Redis Cluster node state +CLUSTER INFO + +# Returns the hash slot of the specified key +CLUSTER KEYSLOT key + +# Force a node cluster to handshake with another node +CLUSTER MEET ip port + +# Get Cluster config for the node +CLUSTER NODES + +# Reconfigure a node as a slave of the specified master node +CLUSTER REPLICATE node-id + +# Reset a Redis Cluster node +CLUSTER RESET [HARD|SOFT] + +# Forces the node to save cluster state on disk +CLUSTER SAVECONFIG + +# Set the configuration epoch in a new node +CLUSTER SET-CONFIG-EPOCH config-epoch + +# Bind a hash slot to a specific node +CLUSTER SETSLOT slot IMPORTING|MIGRATING|STABLE|NODE [node-id] + +# List slave nodes of the specified master node +CLUSTER SLAVES node-id + +# Get array of Cluster slot to node mappings +CLUSTER SLOTS + +# Enables read queries for a connection to a cluster slave node +READONLY + +# Disables read queries for a connection to a cluster slave node +READWRITE + diff --git a/sheets/_redis/connection b/sheets/_redis/connection new file mode 100644 index 0000000..ced560f --- /dev/null +++ b/sheets/_redis/connection @@ -0,0 +1,18 @@ +# Authenticate to the server +AUTH password + +# Echo the given string +ECHO message + +# Ping the server +PING [message] + +# Close the connection +QUIT + +# Change the selected database for the current connection +SELECT index + +# Swaps two Redis databases +SWAPDB index index + diff --git a/sheets/_redis/generic b/sheets/_redis/generic new file mode 100644 index 0000000..f29c20b --- /dev/null +++ b/sheets/_redis/generic @@ -0,0 +1,72 @@ +# Delete a key +DEL key [key ...] + +# Return a serialized version of the value stored at the specified key. +DUMP key + +# Determine if a key exists +EXISTS key [key ...] + +# Set a key's time to live in seconds +EXPIRE key seconds + +# Set the expiration for a key as a UNIX timestamp +EXPIREAT key timestamp + +# Find all keys matching the given pattern +KEYS pattern + +# Atomically transfer a key from a Redis instance to another one. +MIGRATE host port key|"" destination-db timeout [COPY] [REPLACE] [KEYS key [key ...]] + +# Move a key to another database +MOVE key db + +# Inspect the internals of Redis objects +OBJECT subcommand [arguments [arguments ...]] + +# Remove the expiration from a key +PERSIST key + +# Set a key's time to live in milliseconds +PEXPIRE key milliseconds + +# Set the expiration for a key as a UNIX timestamp specified in milliseconds +PEXPIREAT key milliseconds-timestamp + +# Get the time to live for a key in milliseconds +PTTL key + +# Return a random key from the keyspace +RANDOMKEY + +# Rename a key +RENAME key newkey + +# Rename a key, only if the new key does not exist +RENAMENX key newkey + +# Create a key using the provided serialized value, previously obtained using DUMP. +RESTORE key ttl serialized-value [REPLACE] + +# Sort the elements in a list, set or sorted set +SORT key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA] [STORE destination] + +# Alters the last access time of a key(s). Returns the number of existing keys specified. +TOUCH key [key ...] + +# Get the time to live for a key +TTL key + +# Determine the type stored at key +TYPE key + +# Delete a key asynchronously in another thread. Otherwise it is just as DEL, but non blocking. +UNLINK key [key ...] + +# Wait for the synchronous replication of all the write commands sent in the context of the current connection +WAIT numslaves timeout + +# Incrementally iterate the keys space +SCAN cursor [MATCH pattern] [COUNT count] + diff --git a/sheets/_redis/geo b/sheets/_redis/geo new file mode 100644 index 0000000..e6d13ba --- /dev/null +++ b/sheets/_redis/geo @@ -0,0 +1,18 @@ +# Add one or more geospatial items in the geospatial index represented using a sorted set +GEOADD key longitude latitude member [longitude latitude member ...] + +# Returns members of a geospatial index as standard geohash strings +GEOHASH key member [member ...] + +# Returns longitude and latitude of members of a geospatial index +GEOPOS key member [member ...] + +# Returns the distance between two members of a geospatial index +GEODIST key member1 member2 [unit] + +# Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point +GEORADIUS key longitude latitude radius m|km|ft|mi [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count] [ASC|DESC] [STORE key] [STOREDIST key] + +# Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member +GEORADIUSBYMEMBER key member radius m|km|ft|mi [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count] [ASC|DESC] [STORE key] [STOREDIST key] + diff --git a/sheets/_redis/hash b/sheets/_redis/hash new file mode 100644 index 0000000..3f2b55f --- /dev/null +++ b/sheets/_redis/hash @@ -0,0 +1,45 @@ +# Delete one or more hash fields +HDEL key field [field ...] + +# Determine if a hash field exists +HEXISTS key field + +# Get the value of a hash field +HGET key field + +# Get all the fields and values in a hash +HGETALL key + +# Increment the integer value of a hash field by the given number +HINCRBY key field increment + +# Increment the float value of a hash field by the given amount +HINCRBYFLOAT key field increment + +# Get all the fields in a hash +HKEYS key + +# Get the number of fields in a hash +HLEN key + +# Get the values of all the given hash fields +HMGET key field [field ...] + +# Set multiple hash fields to multiple values +HMSET key field value [field value ...] + +# Set the string value of a hash field +HSET key field value + +# Set the value of a hash field, only if the field does not exist +HSETNX key field value + +# Get the length of the value of a hash field +HSTRLEN key field + +# Get all the values in a hash +HVALS key + +# Incrementally iterate hash fields and associated values +HSCAN key cursor [MATCH pattern] [COUNT count] + diff --git a/sheets/_redis/hyperloglog b/sheets/_redis/hyperloglog new file mode 100644 index 0000000..c61dfa6 --- /dev/null +++ b/sheets/_redis/hyperloglog @@ -0,0 +1,9 @@ +# Adds the specified elements to the specified HyperLogLog. +PFADD key element [element ...] + +# Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s). +PFCOUNT key [key ...] + +# Merge N different HyperLogLogs into a single one. +PFMERGE destkey sourcekey [sourcekey ...] + diff --git a/sheets/_redis/list b/sheets/_redis/list new file mode 100644 index 0000000..b1bdc12 --- /dev/null +++ b/sheets/_redis/list @@ -0,0 +1,51 @@ +# Remove and get the first element in a list, or block until one is available +BLPOP key [key ...] timeout + +# Remove and get the last element in a list, or block until one is available +BRPOP key [key ...] timeout + +# Pop a value from a list, push it to another list and return it; or block until one is available +BRPOPLPUSH source destination timeout + +# Get an element from a list by its index +LINDEX key index + +# Insert an element before or after another element in a list +LINSERT key BEFORE|AFTER pivot value + +# Get the length of a list +LLEN key + +# Remove and get the first element in a list +LPOP key + +# Prepend one or multiple values to a list +LPUSH key value [value ...] + +# Prepend a value to a list, only if the list exists +LPUSHX key value + +# Get a range of elements from a list +LRANGE key start stop + +# Remove elements from a list +LREM key count value + +# Set the value of an element in a list by its index +LSET key index value + +# Trim a list to the specified range +LTRIM key start stop + +# Remove and get the last element in a list +RPOP key + +# Remove the last element in a list, prepend it to another list and return it +RPOPLPUSH source destination + +# Append one or multiple values to a list +RPUSH key value [value ...] + +# Append a value to a list, only if the list exists +RPUSHX key value + diff --git a/sheets/_redis/pubsub b/sheets/_redis/pubsub new file mode 100644 index 0000000..43ad5f0 --- /dev/null +++ b/sheets/_redis/pubsub @@ -0,0 +1,18 @@ +# Listen for messages published to channels matching the given patterns +PSUBSCRIBE pattern [pattern ...] + +# Inspect the state of the Pub/Sub subsystem +PUBSUB subcommand [argument [argument ...]] + +# Post a message to a channel +PUBLISH channel message + +# Stop listening for messages posted to channels matching the given patterns +PUNSUBSCRIBE [pattern [pattern ...]] + +# Listen for messages published to the given channels +SUBSCRIBE channel [channel ...] + +# Stop listening for messages posted to the given channels +UNSUBSCRIBE [channel [channel ...]] + diff --git a/sheets/_redis/scripting b/sheets/_redis/scripting new file mode 100644 index 0000000..1c68a74 --- /dev/null +++ b/sheets/_redis/scripting @@ -0,0 +1,21 @@ +# Execute a Lua script server side +EVAL script numkeys key [key ...] arg [arg ...] + +# Execute a Lua script server side +EVALSHA sha1 numkeys key [key ...] arg [arg ...] + +# Set the debug mode for executed scripts. +SCRIPT DEBUG YES|SYNC|NO + +# Check existence of scripts in the script cache. +SCRIPT EXISTS sha1 [sha1 ...] + +# Remove all the scripts from the script cache. +SCRIPT FLUSH + +# Kill the script currently in execution. +SCRIPT KILL + +# Load the specified Lua script into the script cache. +SCRIPT LOAD script + diff --git a/sheets/_redis/server b/sheets/_redis/server new file mode 100644 index 0000000..f2650a6 --- /dev/null +++ b/sheets/_redis/server @@ -0,0 +1,93 @@ +# Asynchronously rewrite the append-only file +BGREWRITEAOF + +# Asynchronously save the dataset to disk +BGSAVE + +# Kill the connection of a client +CLIENT KILL [ip:port] [ID client-id] [TYPE normal|master|slave|pubsub] [ADDR ip:port] [SKIPME yes/no] + +# Get the list of client connections +CLIENT LIST + +# Get the current connection name +CLIENT GETNAME + +# Stop processing commands from clients for some time +CLIENT PAUSE timeout + +# Instruct the server whether to reply to commands +CLIENT REPLY ON|OFF|SKIP + +# Set the current connection name +CLIENT SETNAME connection-name + +# Get array of Redis command details +COMMAND + +# Get total number of Redis commands +COMMAND COUNT + +# Extract keys given a full Redis command +COMMAND GETKEYS + +# Get array of specific Redis command details +COMMAND INFO command-name [command-name ...] + +# Get the value of a configuration parameter +CONFIG GET parameter + +# Rewrite the configuration file with the in memory configuration +CONFIG REWRITE + +# Set a configuration parameter to the given value +CONFIG SET parameter value + +# Reset the stats returned by INFO +CONFIG RESETSTAT + +# Return the number of keys in the selected database +DBSIZE + +# Get debugging information about a key +DEBUG OBJECT key + +# Make the server crash +DEBUG SEGFAULT + +# Remove all keys from all databases +FLUSHALL [ASYNC] + +# Remove all keys from the current database +FLUSHDB [ASYNC] + +# Get information and statistics about the server +INFO [section] + +# Get the UNIX time stamp of the last successful save to disk +LASTSAVE + +# Listen for all requests received by the server in real time +MONITOR + +# Return the role of the instance in the context of replication +ROLE + +# Synchronously save the dataset to disk +SAVE + +# Synchronously save the dataset to disk and then shut down the server +SHUTDOWN [NOSAVE|SAVE] + +# Make the server a slave of another instance, or promote it as master +SLAVEOF host port + +# Manages the Redis slow queries log +SLOWLOG subcommand [argument] + +# Internal command used for replication +SYNC + +# Return the current server time +TIME + diff --git a/sheets/_redis/set b/sheets/_redis/set new file mode 100644 index 0000000..52f9c06 --- /dev/null +++ b/sheets/_redis/set @@ -0,0 +1,45 @@ +# Add one or more members to a set +SADD key member [member ...] + +# Get the number of members in a set +SCARD key + +# Subtract multiple sets +SDIFF key [key ...] + +# Subtract multiple sets and store the resulting set in a key +SDIFFSTORE destination key [key ...] + +# Intersect multiple sets +SINTER key [key ...] + +# Intersect multiple sets and store the resulting set in a key +SINTERSTORE destination key [key ...] + +# Determine if a given value is a member of a set +SISMEMBER key member + +# Get all the members in a set +SMEMBERS key + +# Move a member from one set to another +SMOVE source destination member + +# Remove and return one or multiple random members from a set +SPOP key [count] + +# Get one or multiple random members from a set +SRANDMEMBER key [count] + +# Remove one or more members from a set +SREM key member [member ...] + +# Add multiple sets +SUNION key [key ...] + +# Add multiple sets and store the resulting set in a key +SUNIONSTORE destination key [key ...] + +# Incrementally iterate Set elements +SSCAN key cursor [MATCH pattern] [COUNT count] + diff --git a/sheets/_redis/sorted_set b/sheets/_redis/sorted_set new file mode 100644 index 0000000..4f1572e --- /dev/null +++ b/sheets/_redis/sorted_set @@ -0,0 +1,63 @@ +# Add one or more members to a sorted set, or update its score if it already exists +ZADD key [NX|XX] [CH] [INCR] score member [score member ...] + +# Get the number of members in a sorted set +ZCARD key + +# Count the members in a sorted set with scores within the given values +ZCOUNT key min max + +# Increment the score of a member in a sorted set +ZINCRBY key increment member + +# Intersect multiple sorted sets and store the resulting sorted set in a new key +ZINTERSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX] + +# Count the number of members in a sorted set between a given lexicographical range +ZLEXCOUNT key min max + +# Return a range of members in a sorted set, by index +ZRANGE key start stop [WITHSCORES] + +# Return a range of members in a sorted set, by lexicographical range +ZRANGEBYLEX key min max [LIMIT offset count] + +# Return a range of members in a sorted set, by lexicographical range, ordered from higher to lower strings. +ZREVRANGEBYLEX key max min [LIMIT offset count] + +# Return a range of members in a sorted set, by score +ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count] + +# Determine the index of a member in a sorted set +ZRANK key member + +# Remove one or more members from a sorted set +ZREM key member [member ...] + +# Remove all members in a sorted set between the given lexicographical range +ZREMRANGEBYLEX key min max + +# Remove all members in a sorted set within the given indexes +ZREMRANGEBYRANK key start stop + +# Remove all members in a sorted set within the given scores +ZREMRANGEBYSCORE key min max + +# Return a range of members in a sorted set, by index, with scores ordered from high to low +ZREVRANGE key start stop [WITHSCORES] + +# Return a range of members in a sorted set, by score, with scores ordered from high to low +ZREVRANGEBYSCORE key max min [WITHSCORES] [LIMIT offset count] + +# Determine the index of a member in a sorted set, with scores ordered from high to low +ZREVRANK key member + +# Get the score associated with the given member in a sorted set +ZSCORE key member + +# Add multiple sorted sets and store the resulting sorted set in a new key +ZUNIONSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX] + +# Incrementally iterate sorted sets elements and associated scores +ZSCAN key cursor [MATCH pattern] [COUNT count] + diff --git a/sheets/_redis/string b/sheets/_redis/string new file mode 100644 index 0000000..b0aa521 --- /dev/null +++ b/sheets/_redis/string @@ -0,0 +1,72 @@ +# Append a value to a key +APPEND key value + +# Count set bits in a string +BITCOUNT key [start end] + +# Perform arbitrary bitfield integer operations on strings +BITFIELD key [GET type offset] [SET type offset value] [INCRBY type offset increment] [OVERFLOW WRAP|SAT|FAIL] + +# Perform bitwise operations between strings +BITOP operation destkey key [key ...] + +# Find first bit set or clear in a string +BITPOS key bit [start] [end] + +# Decrement the integer value of a key by one +DECR key + +# Decrement the integer value of a key by the given number +DECRBY key decrement + +# Get the value of a key +GET key + +# Returns the bit value at offset in the string value stored at key +GETBIT key offset + +# Get a substring of the string stored at a key +GETRANGE key start end + +# Set the string value of a key and return its old value +GETSET key value + +# Increment the integer value of a key by one +INCR key + +# Increment the integer value of a key by the given amount +INCRBY key increment + +# Increment the float value of a key by the given amount +INCRBYFLOAT key increment + +# Get the values of all the given keys +MGET key [key ...] + +# Set multiple keys to multiple values +MSET key value [key value ...] + +# Set multiple keys to multiple values, only if none of the keys exist +MSETNX key value [key value ...] + +# Set the value and expiration in milliseconds of a key +PSETEX key milliseconds value + +# Set the string value of a key +SET key value [EX seconds] [PX milliseconds] [NX|XX] + +# Sets or clears the bit at offset in the string value stored at key +SETBIT key offset value + +# Set the value and expiration of a key +SETEX key seconds value + +# Set the value of a key, only if the key does not exist +SETNX key value + +# Overwrite part of a string at key starting at the specified offset +SETRANGE key offset value + +# Get the length of the value stored in a key +STRLEN key + diff --git a/sheets/_redis/transactions b/sheets/_redis/transactions new file mode 100644 index 0000000..7b35d7b --- /dev/null +++ b/sheets/_redis/transactions @@ -0,0 +1,15 @@ +# Discard all commands issued after MULTI +DISCARD + +# Execute all commands issued after MULTI +EXEC + +# Mark the start of a transaction block +MULTI + +# Forget about all watched keys +UNWATCH + +# Watch the given keys to determine execution of the MULTI/EXEC block +WATCH key [key ...] +