You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update hash field expiration details for Redis 8.0 (#2280)
* Update hash field expiration details for Redis 8.0
Added new commands HGETEX and HSETEX for setting expiration on hash fields.
* Apply suggestions from code review
Update to adhere to our style guide.
---------
Co-authored-by: David Dougherty <[email protected]>
Copy file name to clipboardExpand all lines: content/develop/data-types/hashes.md
+7-2Lines changed: 7 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,7 +100,7 @@ See the [complete list of hash commands]({{< relref "/commands/" >}}?group=hash)
100
100
101
101
## Field expiration
102
102
103
-
New in Redis Open Source 7.4 is the ability to specify an expiration time or a time-to-live (TTL) value for individual hash fields.
103
+
Redis 7.4 introduced the ability to specify an expiration time or a time-to-live (TTL) value for individual hash fields.
104
104
This capability is comparable to [key expiration]({{< relref "/develop/using-commands/keyspace#key-expiration" >}}) and includes a number of similar commands.
105
105
106
106
Use the following commands to set either an exact expiration time or a TTL value for specific fields:
@@ -123,6 +123,11 @@ Use the following command to remove the expiration of specific fields:
123
123
124
124
*[`HPERSIST`]({{< relref "/commands/hpersist" >}}): remove the expiration.
125
125
126
+
Redis 8.0 introduced the following commands:
127
+
128
+
*[`HGETEX`]({{< relref "/commands/HGETEX" >}}): Get the value of one or more fields of a given hash key and optionally set their expiration time or time-to-live (TTL).
129
+
*[`HSETEX`]({{< relref "/commands/HSETEX" >}}): Set the value of one or more fields of a given hash key and optionally set their expiration time or time-to-live (TTL).
130
+
126
131
### Common field expiration use cases
127
132
128
133
1.**Event Tracking**: Use a hash key to store events from the last hour. Set each event's TTL to one hour. Use `HLEN` to count events from the past hour.
@@ -201,4 +206,4 @@ In practice, your hashes are limited only by the overall memory on the VMs hosti
201
206
## Learn more
202
207
203
208
*[Redis Hashes Explained](https://www.youtube.com/watch?v=-KdITaRkQ-U) is a short, comprehensive video explainer covering Redis hashes.
204
-
*[Redis University's RU101](https://university.redis.com/courses/ru101/) covers Redis hashes in detail.
209
+
*[Redis University's RU101](https://university.redis.com/courses/ru101/) covers Redis hashes in detail.
0 commit comments