CacheTower
CacheTower copied to clipboard
Manually Trigger Background Refresh
There is one more thing I am wondering about. Is it possible to make a function that can manually refresh the data in the background? Same as with the staleAfter parameter but manually.
cacheStack.RefreshValue(key, function?);
Originally posted by @muskara in https://github.com/TurnerSoftware/CacheTower/issues/187#issuecomment-908348841
More-or-less, could expose it like so:
cacheStack.RefreshCache(cacheKey, valueFactory, cacheSettings);
public void RefreshCache(string cacheKey, Func<T, Task<T>> valueFactory, CacheSettings cacheSettings)
{
_ = RefreshValueAsync(cacheKey, valueFactory, settings, CacheEntryStatus.Forced);
}
Would need to create a second implementation that has Func<T, TContext, Task<T>> valueFactory
for CacheStack<TContext>
support though.