feat: implement HSETEX command - #335
Merged
Merged
Conversation
Adds the Redis 8.0 HSETEX command for setting one or more hash fields with optional FNX/FXX existence conditions and EX/PX/EXAT/PXAT/KEEPTTL expiration handling, gated to redis-8.0+/valkey-9.0+. Part of the redis-8.0 compatibility delta tracked by #299 (a large umbrella issue covering unrelated Redis Stack module families that are out of scope for this change).
ctx.db.getHash() returns the raw hash shape (no .hasField()); the previous FNX/FXX check reimplemented field-expiry logic against it instead of reusing TrackedHashData, which already handles this and is available inside ctx.db.updateHash(). Checking the condition inside that same callback also means a failed condition on a missing key never persists an empty hash, without a separate getHash() pass.
fatal10110
marked this pull request as ready for review
July 2, 2026 05:36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HSETEXsupport withEX/PX/EXAT/PXAT/KEEPTTLandFNX/FXXhandling.redis-8.0/valkey-9.0.Root cause
redis-8.0hash-field TTL support already covered the read/delete side, but the write-sideHSETEXcommand was still missing from the command registry and compatibility profile surface.Validation
TEST_BACKEND=mockfocused ioredis/node-redis HSETEX testsTEST_BACKEND=realfocused ioredis/node-redis HSETEX testsTEST_BACKEND=mock REDIS_COMPAT=redis-7.4|redis-8.0|valkey-9.0profile gatesnpm run buildnpm testnpm run test:integration:mocknpm run test:integration:realnpm run lintRefs #299