Hi, right now I am considering using FusionCache as an integration for an existing project, but have a bit of a challenge since it seems that the L1 and L2 caches have to be exactly the same.
A quick overview:
I am currently using IMemoryCache to store compiled Roslyn objects from a string
I would like to add FusionCache, but would like to do the following:
L1 - store the compilation results (delegates) for execution by callers
L2 - store the string data since serializing the delegates is not a guaranteed process
It looks like FusionCache only serializes what it has in L1 for L2 and no way to provide a distinction. Implementing my own IFusionCacheSerializer might work, but if I return the delegate only for L1, the serializer has no access to the string. I could try storing the string as a pair then see it in L2, but now I have a string and wasted memory since its only needed for the serializer.
Why do this?
The compilation process is a bit painful so I would like the results stored in-memory
FusionCache provides a nice backplane integration that I would like to utilize as well (for scaling-up... or having another service signal a change in data)
I would prefer to not roll my own especially with a battle-tested library available
Hi, right now I am considering using FusionCache as an integration for an existing project, but have a bit of a challenge since it seems that the L1 and L2 caches have to be exactly the same.
A quick overview:
It looks like FusionCache only serializes what it has in L1 for L2 and no way to provide a distinction. Implementing my own
IFusionCacheSerializer
might work, but if I return the delegate only for L1, the serializer has no access to the string. I could try storing the string as a pair then see it in L2, but now I have a string and wasted memory since its only needed for the serializer.Why do this?
Your thoughts would be greatly appreciated!