Skip to content

Commit f185b0f

Browse files
authored
NO TICKET: DEV: add new TCEs to HEXPIRE cmd page (#2323)
1 parent 4561d98 commit f185b0f

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

content/commands/hexpire.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,20 +117,28 @@ In this case, the time to live is _updated_ to the new value.
117117

118118
Starting with Redis 8, the Redis Query Engine has enhanced behavior when handling expiring hash fields. For detailed information about how [`FT.SEARCH`]({{< relref "/commands/ft.search" >}}) and [`FT.AGGREGATE`]({{< relref "/commands/ft.aggregate" >}}) commands interact with expiring hash fields, see [Key and field expiration behavior]({{< relref "/develop/ai/search-and-query/advanced-concepts/expiration" >}}).
119119

120-
## Example
120+
## Examples
121121

122-
```
123-
redis> HEXPIRE no-key 20 NX FIELDS 2 field1 field2
122+
{{< clients-example set="cmds_hash" step="hexpire" >}}
123+
HEXPIRE no-key 20 NX FIELDS 2 field1 field2
124124
(nil)
125-
redis> HSET mykey field1 "hello" field2 "world"
125+
HSET mykey field1 "hello" field2 "world"
126126
(integer) 2
127-
redis> HEXPIRE mykey 10 FIELDS 3 field1 field2 field3
127+
HEXPIRE mykey 10 FIELDS 3 field1 field2 field3
128128
1) (integer) 1
129129
2) (integer) 1
130130
3) (integer) -2
131-
redis> HGETALL mykey
132-
(empty array)
133-
```
131+
HGETALL mykey
132+
{{< /clients-example >}}
133+
134+
Give these commands a try in the interactive console:
135+
136+
{{% redis-cli %}}
137+
HEXPIRE no-key 20 NX FIELDS 2 field1 field2
138+
HSET mykey field1 "hello" field2 "world"
139+
HEXPIRE mykey 10 FIELDS 3 field1 field2 field3
140+
HGETALL mykey
141+
{{% /redis-cli %}}
134142

135143
## Return information
136144

0 commit comments

Comments
 (0)