redis / go-redis

Redis Go client
https://redis.uptrace.dev
BSD 2-Clause "Simplified" License
19.6k stars 2.31k forks source link

Feature: Add Hash Field Expiration Commands #2992

Closed ofekshenawa closed 2 weeks ago

ofekshenawa commented 1 month ago

Description

Introduce new commands that enable setting expiration times for individual fields within a hash. These commands will mirror existing Redis commands for setting key expiration but will be adapted for hash fields.

Proposed Commands

  1. HEXPIRE: Set TTL in seconds for specified fields within a hash.
  2. HPEXPIRE: Set TTL in milliseconds for specified fields within a hash.
  3. HEXPIREAT: Set expiration time as a UNIX timestamp in seconds for specified fields.
  4. HPEXPIREAT: Set expiration time as a UNIX timestamp in milliseconds for specified fields.
  5. HPERSIST: Remove expiration time from specified fields.
  6. HEXPIRETIME: Retrieve the expiration time in seconds for specified fields.
  7. HPEXPIRETIME: Retrieve the expiration time in milliseconds for specified fields.
  8. HTTL: Retrieve the TTL in seconds for specified fields.
  9. HPTTL: Retrieve the TTL in milliseconds for specified fields.

Request for Comments

Feedback on the implementations is highly welcome. Please share any concerns or additional features that should be considered.