You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have recently hit a use case where it would be nice to have an option to reset a cache, e.g. Cachex.reset/2.
Reset would re-initalize all hooks and empty the cache
I'm thinking of three options:
async: the default option which casts instead of calling
only: a list of things to reset, e.g. [ :cache, :hooks ]
so only: :hooks would reset hook states but not the cache itself
hooks: a list of hooks to reset, if you wish to only reset certain hooks.
Here are a couple of examples:
Cachex.reset(:my_cache)# wipes cache, resets all hooksCachex.reset(:my_cache,only: :hooks)# only resets the hooks of a cache, leaves it filledCachex.reset(:my_cache,hooks: [Cachex.Stats])# only resets the stats hook
The text was updated successfully, but these errors were encountered:
I have recently hit a use case where it would be nice to have an option to reset a cache, e.g.
Cachex.reset/2
.Reset would re-initalize all hooks and empty the cache
I'm thinking of three options:
async
: the default option which casts instead of callingonly
: a list of things to reset, e.g.[ :cache, :hooks ]
only: :hooks
would reset hook states but not the cache itselfhooks
: a list of hooks to reset, if you wish to only reset certain hooks.Here are a couple of examples:
The text was updated successfully, but these errors were encountered: