Skip to content

Support HSET+expire in one command, at infra level#13230

Merged
moticless merged 5 commits intoredis:hash-field-expiry-integfrom
moticless:hfe-integ-hset-with-expire
Apr 25, 2024
Merged

Support HSET+expire in one command, at infra level#13230
moticless merged 5 commits intoredis:hash-field-expiry-integfrom
moticless:hfe-integ-hset-with-expire

Conversation

@moticless
Copy link
Copy Markdown
Collaborator

@moticless moticless commented Apr 22, 2024

Unify infra of HSETF, HEXPIRE, HSET and provide API for RDB load as well.

Whereas setting plain fields is rather straightforward, setting expiration
time to fields might be time-consuming and complex since each update of
expiration time, not only updates ebuckets of corresponding hash, but also
might update ebuckets of global HFE DS. It is required to opt sequence of
field updates with expirartion for a given hash, such that only once done,
the global HFE DS will get updated.

To do so, follow the scheme:

  1. Call hashTypeSetExInit() to initialize the HashTypeSetEx struct.
  2. Call hashTypeSetEx() one time or more, for each field/expiration update.
  3. Call hashTypeSetExDone() for notification and update of global HFE.

If expiration is not required, then avoid this API and use instead hashTypeSet()

@moticless moticless changed the base branch from unstable to hash-field-expiry-integ April 22, 2024 07:39
@moticless moticless marked this pull request as ready for review April 24, 2024 08:02
@moticless moticless merged commit c33c91d into redis:hash-field-expiry-integ Apr 25, 2024
@moticless moticless deleted the hfe-integ-hset-with-expire branch April 25, 2024 15:29
funny-dog pushed a commit to funny-dog/redis that referenced this pull request Sep 17, 2025
Unify infra of `HSETF`, `HEXPIRE`, `HSET` and provide API for RDB load
as well. Whereas setting plain fields is rather straightforward, setting
expiration time to fields might be time-consuming and complex since each 
update of expiration time, not only updates `ebuckets` of corresponding hash, 
but also might update `ebuckets` of global HFE DS. It is required to opt 
sequence of field updates with expirartion for a given hash, such that only once
done, the global HFE DS will get updated.

To do so, follow the scheme:
1. Call `hashTypeSetExInit()` to initialize the HashTypeSetEx struct.
2. Call `hashTypeSetEx()` one time or more, for each field/expiration update.
3. Call `hashTypeSetExDone()` for notification and update of global HFE.

If expiration is not required, then avoid this API and use instead hashTypeSet().
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.

2 participants