ZiggyCreatures / FusionCache

FusionCache is an easy to use, fast and robust hybrid cache with advanced resiliency features.
MIT License
1.87k stars 96 forks source link

[FEATURE] Post factory executed event with possibility to change the cache settings before it be inserted in cache #209

Closed viniciusvarzea closed 8 months ago

viniciusvarzea commented 8 months ago

Problem

I need to set the cache duration after the factory is executed (based on the result of the factory) but before the result from factory be inserted in the cache.

Solution

Maybe accepts a action with the some context in method (GetOrSetAsync) as a parameter, that will be called after a factory runs but before the result of the factory be inserted in the cache.

jodydonetti commented 8 months ago

Hi @viniciusvarzea and thanks for using FusionCache!

What you are looking for is already implemented and is called Adaptive Caching.

Hope this helps.

jodydonetti commented 8 months ago

Hi @viniciusvarzea , did it work?

viniciusvarzea commented 8 months ago

@jodydonetti you are the best! It works