Problem
We're storing a tree structure as a flat list in FusionCache with distributed cache and backplane.
Most requests read that flat list and process it into a tree for various operations. Some requests do need it in the flat format, so ideally both formats would be available.
Ideally the processing could be done once per server and stored in memory without needing to increase the size of what's being stored in the distributed cache.
Solution
Perhaps a callback that allows manipulating the data returned by the distributed cache before it's given to the memory cache?
Alternatives
- Store the tree and flat versions of the data together in both distributed and memory cache
- Simple but means we're storing and fetching double the necessary data in the distributed cache
- Store the tree and flat versions separately in both distributed and memory cache
- Means each time the data changes we need to do two invalidations instead of just one
- Store only the flat data in FusionCache and store the processed result in a separate memory cache
- We'd need to manually manage invalidating the memory cache