Skip to content

Add HPEXPIRETIME and HGETEX hash commands#6625

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/add-hpexpiretime-hgetex-commands
Draft

Add HPEXPIRETIME and HGETEX hash commands#6625
Copilot wants to merge 5 commits intomainfrom
copilot/add-hpexpiretime-hgetex-commands

Conversation

Copy link
Contributor

Copilot AI commented Feb 14, 2026

Implements Redis 7.4+ hash field expiration commands: HPEXPIRETIME for querying expiration times and HGETEX for atomic get-with-optional-set-TTL.

Implementation

HPEXPIRETIME

  • Returns absolute Unix timestamps in milliseconds for hash field expiration
  • Return values: -2 (key not found), -1 (no TTL), -3 (field not found), or timestamp

HGETEX

  • Retrieves field values with optional TTL update in single operation
  • Supports EX, PX, EXAT, PXAT options
  • Automatically converts listpack to StringMap when setting field-level TTL
  • Note: PERSIST option deferred (requires expiry removal API not in StringMap)

Example

# Set hash fields with expiration
> HSETEX mykey 30 f1 v1 f2 v2
(integer) 2

# Query expiration times in milliseconds
> HPEXPIRETIME mykey FIELDS 2 f1 f2
1) (integer) 1675209630000
2) (integer) 1675209630000

# Get values and update TTL atomically
> HGETEX mykey EX 60 FIELDS 2 f1 f2
1) "v1"
2) "v2"

Technical Notes

  • HPEXPIRETIME uses read-only transaction path
  • HGETEX switches to write path only when expiration option provided
  • Both registered with CO::FAST flag for performance
  • Ceiling division for PX duration conversion, direct division for PXAT timestamps
Original prompt

This section details on the original issue you should resolve

<issue_title>Please add the HPEXPIRETIME HGETEX commands</issue_title>
<issue_description>Redis has the HPEXPIRETIME and HGETEX commands. Can we add HPEXPIRETIME and HGETEX commands?</issue_description>

<agent_instructions>Add tests, also cover all parameters that Redis supports</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add HPEXPIRETIME and HGETEX commands to Redis Add HPEXPIRETIME and HGETEX hash commands Feb 14, 2026
Copilot AI requested a review from BorysTheDev February 14, 2026 16:10
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

Successfully merging this pull request may close these issues.

Please add the HPEXPIRETIME HGETEX commands

2 participants