Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

support parsing client-cache invalidation messages #3007

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mhelmich
Copy link

@mhelmich mhelmich commented May 31, 2024

This PR adds support for parsing redis client-side caching invalidation messages.
Today, these messages are not parsed properly and an error is returned instead.
With this PR, messages are parsed into a Message and the array of invalidated cache key is passed to the caller inside PayloadSlice of the message.
This PR does not add a cache to the client or enables the client-side caching feature. It merely plumbs invalidation messages through to the caller. A caching mechanism can (and has to) be built on top of this change.

Details about redis' client-side caching feature can be found here: https://redis.io/docs/latest/develop/use/client-side-caching/

@mhelmich mhelmich force-pushed the mh/parse-invalidate-subscription-message branch 10 times, most recently from d253629 to 999b49e Compare May 31, 2024 20:53
@mhelmich mhelmich changed the title Mh/parse invalidate subscription message support parsing client-cache invalidation messages May 31, 2024
@mhelmich mhelmich force-pushed the mh/parse-invalidate-subscription-message branch from 999b49e to 13c3db3 Compare May 31, 2024 21:10
@mhelmich mhelmich marked this pull request as ready for review May 31, 2024 21:38
@mhelmich mhelmich force-pushed the mh/parse-invalidate-subscription-message branch 4 times, most recently from 90cc0d3 to eba9a0f Compare May 31, 2024 23:10
@mhelmich mhelmich force-pushed the mh/parse-invalidate-subscription-message branch from eba9a0f to 4c6d248 Compare May 31, 2024 23:29
@mhelmich
Copy link
Author

Hi @chayim and @ofekshenawa 👋
I'm roping you into this PR because you were also part of the relevant discussion (#2370). I'm hoping to get some traction on this PR.

invalidateClient.Close()

mu.Lock()
invalidateClientID = -1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you use atomic.Int32 to update this variable
such that !

  1. Mutex will get removed
    2.on line [617] (support parsing client-cache invalidation messages #3007 (comment)) you are already locking the mutex, so there is a chance of double locking mutex

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants