Skip to content

Manually Trigger Background Refresh #189

Description

@Turnerj

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)

Activity

  1. Turnerj commented on Jun 25, 2022

    @Turnerj
    MemberAuthor

    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);
    }
  2. Turnerj commented on Jun 25, 2022

    @Turnerj
    MemberAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions