Closed dotTrench closed 2 months ago
Hi @dotTrench , I think you are right. Let me think about it a moment and will get back to you. Thanks!
I'm implementing this, will update later with some news about it. Thanks again!
Hi @dotTrench , I've added support for this, and 1 extra tag:
"fusioncache.hit"
(bool
)"fusioncache.stale"
(bool
)I was already using "fusioncache.hit"
somewhere else, so I preferred uniformity, and also both are very general concepts (hit/miss and stale/fresh).
Will release the next version very soon, probably tomorrow.
Thank you, that's great man! The tags makes sense.
I really appreciate the work you've put into this library, it has saved me a lot of time and pain!
Hi, v1.4.0 has been released 🥳
Problem
Currently the tags for an activity does not contain any tags indicating whether a cache lookup resulted in a miss or a hit. This would probably be applicable to the: TryGet, GetOrDefault, GetOrSet, MemoryGet, DistributedGet activities defined in Activities.Names.
Solution
Add tags indicating whether a cache to the activity before it's disposed. e.g. "fusioncache.operation.hit": true/false
Alternatives
The current workarounds I can figure out to indicate whether a cache hit occurs on an activity that I can figure out is to attach an event handler to the FusionCache instance and enrich the ongoing or a wrapping activity from there. e.g.
however this would also require me to set EnableSyncEventHandlersExecution to true to ensure that the activity is not disposed before setting the tag.
Additional context
I'm not really sure how this would interact with FailSafe as this is not something I personally use, but probably keep this in consideration.