Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yringler/distributed-middleware-cache
A fork of ResponseCachingMiddleware which allows a custom IResponseCache
https://github.com/yringler/distributed-middleware-cache
Last synced: about 1 month ago
JSON representation
A fork of ResponseCachingMiddleware which allows a custom IResponseCache
- Host: GitHub
- URL: https://github.com/yringler/distributed-middleware-cache
- Owner: yringler
- License: mit
- Created: 2020-05-05T18:23:58.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-11-03T14:58:18.000Z (about 3 years ago)
- Last Synced: 2024-05-21T11:10:22.885Z (7 months ago)
- Language: C#
- Size: 81.1 KB
- Stars: 3
- Watchers: 6
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://docs.microsoft.com/en-us/aspnet/core/performance/caching/middleware?view=aspnetcore-3.1). 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.```c#
public void ConfigureServices(IServiceCollection services)
{
services.AddResponseCaching(options =>
{
options.ResponseCachingStrategy = ResponseCachingStrategy.Distributed;
});
}
```
```c#
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.