Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually Trigger Background Refresh #189

Open
Turnerj opened this issue Aug 31, 2021 · 2 comments
Open

Manually Trigger Background Refresh #189

Turnerj opened this issue Aug 31, 2021 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Turnerj
Copy link
Member

Turnerj commented Aug 31, 2021

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 #187 (comment)

@Turnerj
Copy link
Member Author

Turnerj commented Jun 25, 2022

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);
}

@Turnerj
Copy link
Member Author

Turnerj commented Jun 25, 2022

Would need to create a second implementation that has Func<T, TContext, Task<T>> valueFactory for CacheStack<TContext> support though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant