Skip to content

A fork of ResponseCachingMiddleware which allows a custom IResponseCache

License

Notifications You must be signed in to change notification settings

yringler/distributed-middleware-cache

Repository files navigation

flex-middleware-cache

A fork of ResponseCachingMiddleware which provides more flexibility. Note that it uses official aspnetcore code directly (via git submodules and csproj linking).

DistributedResponseCache

Usage is similar to ResponseCachingMiddleware. Set the ResponseCachingStrategy to ResponseCachingStrategy.Distributed when calling AddResponseCaching and replace UseResponseCaching with UseCustomResponseCaching.
It will use whatever implementation of IDistributedCache that is injected into it.

public void ConfigureServices(IServiceCollection services)
{
    services.AddResponseCaching(options =>
    {
        options.ResponseCachingStrategy = ResponseCachingStrategy.Distributed;
    });
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    app.UseCustomResponseCaching();
}

ModifiableDistributedResponseCache

This is a wrapper around DistributedResponseCache which allows you to easily exert some basic control over the underlying IDistributedCache. You can use your own custom logic to force the cache to clear, or to just ignore it.
To use, set the ResponseCachingStrategy to ResponseCachingStrategy.ModifiableDistributed and call UseCustomResponseCaching().
And inject IModifiableCacheController into the service provider.

About

A fork of ResponseCachingMiddleware which allows a custom IResponseCache

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages