-
Notifications
You must be signed in to change notification settings - Fork 167
Description
Scenario
With FusionCache it's very easy to handle 2 cache levels at the same time.
The 1st level is a memory cache while the second is a distributed cache: we just specify a distributed cache during the initial setup and FusionCache will automatically coordinate the dance between the 2 layers, in an optimized way, without us having to do any extra activity.
Problem
Sometimes though, when using a 2nd layer, we may need to not use it, only for a couple of specific method calls.
Today this is not possible: if you have setup a 2nd layer, it will be used in all method calls.
Some members of the community also asked for this.
Solution
The solution would be to add a new option in the FusionCacheEntryOptions
class, namely SkipDistributedCache
: when set to true
the 2nd layer (distributed cache) will be totally ignored (it defaults to false
).
On top of the option itself, an additional SetSkipDistributedCache(...)
method on the FusionCacheEntryOptions
class should be added to set the option value in a fluent-interface way, like the other already existing methods.
Backplane care
A particular point of interest is the use of a backplane without a distributed cache, because if we're not extra careful that combo may lead to unexpected results (see here).
When using a distributed cache + a backplane everything is fine, but by introducing the ability to skip the distributed cache for specific calls we are also introducing the possibility of unintendedly falling into that trap for those calls.
Because of this, the idea is for the SetSkipDistributedCache(...)
method to have 2 bool
params: one to drive the new option, and one to drive the option to also skip backplane notifications.
By using the common method to change the option, the user will also have to think about the consequences of that, and ideally avoid mistakes.