diff --git a/content/commands/auth/index.md b/content/commands/auth/index.md index 7e18f8d17b..0d9f9ee63a 100644 --- a/content/commands/auth/index.md +++ b/content/commands/auth/index.md @@ -51,7 +51,9 @@ The AUTH command authenticates the current connection in two cases: Redis versions prior of Redis 6 were only able to understand the one argument version of the command: - AUTH +{{< clients-example cmds_cnxmgmt auth1 >}} +AUTH "temp-pass" +{{< /clients-example >}} This form just authenticates against the password set with `requirepass`. In this configuration Redis will deny any command executed by the just @@ -62,7 +64,9 @@ Otherwise, an error is returned and the clients needs to try a new password. When Redis ACLs are used, the command should be given in an extended way: - AUTH +{{< clients-example cmds_cnxmgmt auth2 >}} +AUTH "test-user" "strong_password" +{{< /clients-example >}} In order to authenticate the current connection with one of the connections defined in the ACL list (see [`ACL SETUSER`]({{< relref "/commands/acl-setuser" >}})) and the official [ACL guide]({{< relref "/operate/oss_and_stack/management/security/acl" >}}) for more information. diff --git a/content/commands/flushall/index.md b/content/commands/flushall/index.md index 1edccfcd4a..36ae58f683 100644 --- a/content/commands/flushall/index.md +++ b/content/commands/flushall/index.md @@ -62,6 +62,10 @@ It is possible to use one of the following modifiers to dictate the flushing mod * `ASYNC`: flushes the databases asynchronously * `SYNC`: flushes the databases synchronously +{{< clients-example cmds_servermgmt flushall >}} +FLUSHALL SYNC +{{< /clients-example >}} + ## Notes * An asynchronous `FLUSHALL` command only deletes keys that were present at the time the command was invoked. Keys created during an asynchronous flush will be unaffected. diff --git a/content/commands/hgetall/index.md b/content/commands/hgetall/index.md index 380a76973f..89e6d77099 100644 --- a/content/commands/hgetall/index.md +++ b/content/commands/hgetall/index.md @@ -53,6 +53,20 @@ of the reply is twice the size of the hash. ## Examples +{{< clients-example cmds_hash hgetall >}} +redis> HSET myhash field1 "Hello" +(integer) 1 +redis> HSET myhash field2 "World" +(integer) 1 +redis> HGETALL myhash +1) "field1" +2) "Hello" +3) "field2" +4) "World" +{{< /clients-example >}} + +Give these commands a try in the interactive console: + {{% redis-cli %}} HSET myhash field1 "Hello" HSET myhash field2 "World" diff --git a/content/commands/hvals/index.md b/content/commands/hvals/index.md index 3c958999be..99e10d1a1c 100644 --- a/content/commands/hvals/index.md +++ b/content/commands/hvals/index.md @@ -51,6 +51,18 @@ Returns all values in the hash stored at `key`. ## Examples +{{< clients-example cmds_hash hvals >}} +redis> HSET myhash field1 "Hello" +(integer) 1 +redis> HSET myhash field2 "World" +(integer) 1 +redis> HVALS myhash +1) "Hello" +2) "World" +{{< /clients-example >}} + +Give these commands a try in the interactive console: + {{% redis-cli %}} HSET myhash field1 "Hello" HSET myhash field2 "World" diff --git a/content/commands/info/index.md b/content/commands/info/index.md index 7f0d494ced..3bc68741e2 100644 --- a/content/commands/info/index.md +++ b/content/commands/info/index.md @@ -68,6 +68,12 @@ It can also take the following values: When no parameter is provided, the `default` option is assumed. +{{< clients-example cmds_servermgmt info >}} +INFO +{{< /clients-example >}} + +Give these commands a try in the interactive console: + {{% redis-cli %}} INFO {{% /redis-cli %}} diff --git a/content/commands/llen/index.md b/content/commands/llen/index.md index 7da4b3e676..1573e29bc1 100644 --- a/content/commands/llen/index.md +++ b/content/commands/llen/index.md @@ -51,6 +51,17 @@ An error is returned when the value stored at `key` is not a list. ## Examples +{{< clients-example cmds_list llen >}} +redis> LPUSH mylist "World" +(integer) 1 +redis> LPUSH mylist "Hello" +(integer) 2 +redis> LLEN mylist +(integer) 2 +{{< /clients-example >}} + +Give these commands a try in the interactive console: + {{% redis-cli %}} LPUSH mylist "World" LPUSH mylist "Hello" diff --git a/content/commands/lpop/index.md b/content/commands/lpop/index.md index 09ba05f510..61c8c67801 100644 --- a/content/commands/lpop/index.md +++ b/content/commands/lpop/index.md @@ -65,6 +65,21 @@ to `count` elements, depending on the list's length. ## Examples +{{< clients-example cmds_list lpop >}} +redis> RPUSH mylist "one" "two" "three" "four" "five" +(integer) 5 +redis> LPOP mylist +"one" +redis> LPOP mylist 2 +1) "two" +2) "three" +redis> LRANGE mylist 0 -1 +1) "four" +2) "five" +{{< /clients-example>}} + +Give these commands a try in the interactive console: + {{% redis-cli %}} RPUSH mylist "one" "two" "three" "four" "five" LPOP mylist diff --git a/content/commands/lpush/index.md b/content/commands/lpush/index.md index 5ee7bb8e3f..339d5dfab3 100644 --- a/content/commands/lpush/index.md +++ b/content/commands/lpush/index.md @@ -69,10 +69,20 @@ So for instance the command `LPUSH mylist a b c` will result into a list containing `c` as first element, `b` as second element and `a` as third element. ## Examples +{{< clients-example cmds_list lpush >}} +redis> LPUSH mylist "world" +(integer) 1 +redis> LPUSH mylist "hello" +(integer) 2 +redis> LRANGE mylist 0 -1 +1) "hello" +2) "world" +{{< /clients-example >}} + +Give these commands a try in the interactive console: {{% redis-cli %}} LPUSH mylist "world" LPUSH mylist "hello" LRANGE mylist 0 -1 {{% /redis-cli %}} - diff --git a/content/commands/lrange/index.md b/content/commands/lrange/index.md index 92a6cc832c..14c361e7ff 100644 --- a/content/commands/lrange/index.md +++ b/content/commands/lrange/index.md @@ -80,6 +80,29 @@ the last element of the list. ## Examples +{{< clients-example cmds_list lrange >}} +redis> RPUSH mylist "one" +(integer) 1 +redis> RPUSH mylist "two" +(integer) 2 +redis> RPUSH mylist "three" +(integer) 3 +redis> LRANGE mylist 0 0 +1) "one" +redis> LRANGE mylist -3 2 +1) "one" +2) "two" +3) "three" +redis> LRANGE mylist -100 100 +1) "one" +2) "two" +3) "three" +redis> LRANGE mylist 5 10 +(empty array) +{{< /clients-example >}} + +Give these commands a try in the interactive console: + {{% redis-cli %}} RPUSH mylist "one" RPUSH mylist "two" @@ -89,4 +112,3 @@ LRANGE mylist -3 2 LRANGE mylist -100 100 LRANGE mylist 5 10 {{% /redis-cli %}} - diff --git a/content/commands/rpop/index.md b/content/commands/rpop/index.md index 1085d2d323..a7da667d45 100644 --- a/content/commands/rpop/index.md +++ b/content/commands/rpop/index.md @@ -65,10 +65,24 @@ to `count` elements, depending on the list's length. ## Examples +{{< clients-example cmds_list rpop >}} +redis> RPUSH mylist "one" "two" "three" "four" "five" +(integer) 5 +redis> RPOP mylist +"five" +redis> RPOP mylist 2 +1) "four" +2) "three" +redis> LRANGE mylist 0 -1 +1) "one" +2) "two" +{{< /clients-example >}} + +Give these commands a try in the interactive console: + {{% redis-cli %}} RPUSH mylist "one" "two" "three" "four" "five" RPOP mylist RPOP mylist 2 LRANGE mylist 0 -1 {{% /redis-cli %}} - diff --git a/content/commands/rpush/index.md b/content/commands/rpush/index.md index 8d5d9cdb13..c4367831d1 100644 --- a/content/commands/rpush/index.md +++ b/content/commands/rpush/index.md @@ -70,6 +70,18 @@ containing `a` as first element, `b` as second element and `c` as third element. ## Examples +{{< clients-example cmds_list rpush >}} +redis> RPUSH mylist "hello" +(integer) 1 +redis> RPUSH mylist "world" +(integer) 2 +redis> LRANGE mylist 0 -1 +1) "hello" +2) "world" +{{< /clients-example >}} + +Give these commands a try in the interactive console: + {{% redis-cli %}} RPUSH mylist "hello" RPUSH mylist "world" diff --git a/content/commands/sadd/index.md b/content/commands/sadd/index.md index 95f7b932c4..ae67f6e7bb 100644 --- a/content/commands/sadd/index.md +++ b/content/commands/sadd/index.md @@ -64,10 +64,23 @@ An error is returned when the value stored at `key` is not a set. ## Examples +{{< clients-example cmds_set sadd >}} +redis> SADD myset "Hello" +(integer) 1 +redis> SADD myset "World" +(integer) 1 +redis> SADD myset "World" +(integer) 0 +redis> SMEMBERS myset +1) "Hello" +2) "World" +{{< /clients-example >}} + +Give these commands a try in the interactive console: + {{% redis-cli %}} SADD myset "Hello" SADD myset "World" SADD myset "World" SMEMBERS myset {{% /redis-cli %}} - diff --git a/content/commands/smembers/index.md b/content/commands/smembers/index.md index a4d74fd3ed..8ba8ab6957 100644 --- a/content/commands/smembers/index.md +++ b/content/commands/smembers/index.md @@ -53,9 +53,20 @@ This has the same effect as running [`SINTER`]({{< relref "/commands/sinter" >}} ## Examples +{{< clients-example cmds_set smembers >}} +redis> SADD myset "Hello" +(integer) 1 +redis> SADD myset "World" +(integer) 1 +redis> SMEMBERS myset +1) "Hello" +2) "World" +{{< /clients-example >}} + +Give these commands a try in the interactive console: + {{% redis-cli %}} SADD myset "Hello" SADD myset "World" SMEMBERS myset {{% /redis-cli %}} -