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

Please add a Clear() method #195

Open
DavidThielen opened this issue Mar 22, 2024 · 1 comment
Open

Please add a Clear() method #195

DavidThielen opened this issue Mar 22, 2024 · 1 comment

Comments

@DavidThielen
Copy link

Disposing and then creating a new cache is problematic at times. Having a Clear() method resolves that.

I think adding ICacheProvider.Clear() is the best way to do this. But here is code that works:

       public static void ExClear(this IAppCache service)
       {
        IMemoryCache? provider = service.CacheProvider.GetPrivateFieldValue<IMemoryCache>("cache");
        if (provider is MemoryCache memoryCache)
	        memoryCache.Clear();
           else Trap.Break(); // need to find a solution for this!!!
       }
@yaugkeer
Copy link

sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants