Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC-4423: add TCEs for various command pages #1037

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions content/commands/auth/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <password>
{{< 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
Expand All @@ -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 <username> <password>
{{< 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.
Expand Down
4 changes: 4 additions & 0 deletions content/commands/flushall/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 14 additions & 0 deletions content/commands/hgetall/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 12 additions & 0 deletions content/commands/hvals/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions content/commands/info/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}}
Expand Down
11 changes: 11 additions & 0 deletions content/commands/llen/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
15 changes: 15 additions & 0 deletions content/commands/lpop/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion content/commands/lpush/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}}

24 changes: 23 additions & 1 deletion content/commands/lrange/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -89,4 +112,3 @@ LRANGE mylist -3 2
LRANGE mylist -100 100
LRANGE mylist 5 10
{{% /redis-cli %}}

16 changes: 15 additions & 1 deletion content/commands/rpop/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}}

12 changes: 12 additions & 0 deletions content/commands/rpush/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
15 changes: 14 additions & 1 deletion content/commands/sadd/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}}

13 changes: 12 additions & 1 deletion content/commands/smembers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}}

Loading