Skip to content

Commit ebacef0

Browse files
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]>
1 parent 0118d6c commit ebacef0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

content/develop/data-types/hashes.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ See the [complete list of hash commands]({{< relref "/commands/" >}}?group=hash)
100100

101101
## Field expiration
102102

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.
104104
This capability is comparable to [key expiration]({{< relref "/develop/using-commands/keyspace#key-expiration" >}}) and includes a number of similar commands.
105105

106106
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:
123123

124124
* [`HPERSIST`]({{< relref "/commands/hpersist" >}}): remove the expiration.
125125

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+
126131
### Common field expiration use cases
127132

128133
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
201206
## Learn more
202207

203208
* [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

Comments
 (0)