Skip to content

Distributed cache clobbered by memory cache with multiple servers #3

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

Open
rnelson opened this issue Dec 7, 2024 · 0 comments
Open

Comments

@rnelson
Copy link
Owner

rnelson commented Dec 7, 2024

HybridCache is designed to check the memory cache then update the distributed cache, which isn't quite what I had in mind.

This presents a problem because two separate APIs in the distributed example (simulating multiple instances of an API in a cluster of some sort) have their memory cache with their own local counts and they never read from the distributed cache (Redis) when the memory one exists. This results in the two APIs constantly overwriting one another instead of relying on the Redis value.

It's possible to disable local cache (entirely, or just read, or just write) or to drastically lower its expiration to minimize the issue, but that requires knowing that we're using the IDistributedCache. I haven't found a way to determine that and want to avoid adding a configuration item.

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

No branches or pull requests

1 participant