-
Notifications
You must be signed in to change notification settings - Fork 171
Description
Use Case: Granular Caching for Entity Lists
Hi, and thanks for this amazing library!
I have a use case involving multiple microservices communicating with each other and caching shared entities.
Scenario:
Imagine I have a microservice that requests entities 1 and 2 together and caches them. Later, that microservice requests entities 2 and 3 and also caches them.
The problem is that entity 2 is now cached twice, separately, and when entity 2 gets updated, I need to invalidate it in both places — which is error-prone and inefficient.
To solve this, I want to cache each entity separately using a per-entity cache key (e.g., entity:{id}). So when I need a list of entities, I can check which ones are already in the cache and which ones are missing, then fetch only the missing ones from the source.
This requires an efficient batch get/check mechanism from the cache.
My question:
Does FusionCache support (or plan to support) a way to:
- Provide a list of keys
- Retrieve the cached values for those keys (if present)
- Identify which keys are missing from the cache
This would allow me to implement a smart caching strategy where only uncached entities are fetched, and already cached ones are reused.
What would be the best strategy to implement this pattern with FusionCache?
Thanks in advance!