-
Notifications
You must be signed in to change notification settings - Fork 22
feat: add non-destructive cache hydration support via isInitialHydrat… #181
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
Conversation
…ion context - Add SetContext type with isInitialHydration flag - Update Handler interface to accept optional SetContext in set() - Implement NX behavior in redis-strings handler when isInitialHydration is true - Update all handlers (local-lru, composite) to accept ctx parameter - Propagate isInitialHydration flag from registerInitialCache to handlers - Prevents runtime cache overwrites during app restarts and horizontal scaling Addresses fortedigital#23
|
Hi @AyronK, I've implemented a solution for #23 . I'd really appreciate your thoughts on this implementation before marking it as ready for review. Approach chosenInstead of adding the option to
Happy to adjust anything - just wanted to get your feedback on the architecture first! |
AyronK
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work overall, I added a couple of comments for cosmetics. However I really would like to make opt-in behavior with default as it was.
Also, could you update readme section of instrumentation / initial cache registration to mention this option?
packages/nextjs-cache-handler/src/handlers/cache-handler.types.ts
Outdated
Show resolved
Hide resolved
packages/nextjs-cache-handler/src/instrumentation/register-initial-cache.ts
Outdated
Show resolved
Hide resolved
Make non-destructive cache writes opt-in, improve naming, handler behavior, and documentation following review comments.
|
Thanks for the review! I’ve addressed all the comments:
Please let me know if you’d like any further adjustments. |
AyronK
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very solid PR now, thanks!
…ion context
Addresses #23