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

[NEW] Add HEXPIRE and new features in 7.4 #1070

Closed
tobiasBora opened this issue Sep 24, 2024 · 2 comments
Closed

[NEW] Add HEXPIRE and new features in 7.4 #1070

tobiasBora opened this issue Sep 24, 2024 · 2 comments

Comments

@tobiasBora
Copy link

The problem/use-case that the feature addresses

Redis 7.4 introduces notably HEXPIRE, that extend EXPIRE to individual keys of a hash function. This is quite practical for many reasons, for instance I use it to count the number of connected users on each server, and the HEXPIRE allows me to remove keys when the server has been offline for too long (e.g. due to a crash).

More generally, here are the new commands introduced in 7.4, from https://raw.githubusercontent.com/redis/redis/7.4/00-RELEASENOTES:

  • HEXPIRE and HPEXPIRE set the remaining time to live for specific fields
  • HEXPIREAT and HPEXPIREAT set the expiration time to a UNIX timestamp for specific fields
  • HPERSIST removes the expiration for specific fields
  • HEXPIRETIME and HPEXPIRETIME get the expiration time for specific fields
  • HTTL and HPTTL get the remaining time to live for specific fields

Description of the feature

Same as in https://redis.io/docs/latest/commands/hexpire/

Alternatives you've considered

Creating keys for each item… but then it is hard to keep track of them all, as KEYS is not recommended in production: https://stackoverflow.com/questions/30728973/redis-get-all-keys-values-from-redis-with-prefix

@zuiderkwast
Copy link
Contributor

Yes, see also #640. We want to add this but it's not trivial.

If or when we add it, we should use the same commands as redis.

@PingXie
Copy link
Member

PingXie commented Sep 25, 2024

Let's continue the discussion on #640.

@PingXie PingXie closed this as completed Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants