IL.RulesBasedOutputCache
1.0.12
Versions with annoying bugs
See the version list below for details.
dotnet add package IL.RulesBasedOutputCache --version 1.0.12
NuGet\Install-Package IL.RulesBasedOutputCache -Version 1.0.12
<PackageReference Include="IL.RulesBasedOutputCache" Version="1.0.12" />
paket add IL.RulesBasedOutputCache --version 1.0.12
#r "nuget: IL.RulesBasedOutputCache, 1.0.12"
// Install IL.RulesBasedOutputCache as a Cake Addin #addin nuget:?package=IL.RulesBasedOutputCache&version=1.0.12 // Install IL.RulesBasedOutputCache as a Cake Tool #tool nuget:?package=IL.RulesBasedOutputCache&version=1.0.12
Output cache middleware
- Rules based output cache middleware - inspired by Microsoft output cache
Setup
v5 startup files structure (Program.cs and Startup.cs files)
ConfigureServices(IServiceCollection services)
services.AddRulesBasedOutputCache();
...
app.UseRulesBasedOutputCache();
v6+ startup files structure (Single Progam.cs file)
var builder = WebApplication.CreateBuilder(args);
builder.AddRulesBasedOutputCache();
...
var app = builder.Build();
app.UseRulesBasedOutputCache();
Tags management
In order to tag cache entries there are few extension methods available (IL.RulesBasedOutputCache.Helpers
namespace):
void ApplyCustomCacheTagToCurrentRequest(this HttpContext context, string tag)
ApplyCustomCacheTagsToCurrentRequest(this HttpContext context, HashSet<string> tags)
which you can use to apply one or multiple tags to current request/potential cache entry.
Tags can be used for cache invalidation.
Cache invalidation
As library heavily relies on microsoft implementation of output cache you can use IOutputCacheStore
for eviction of cached entries by their tags.
await _store.EvictByTagAsync("CacheTag", HttpContext.RequestAborted);
Extra configurations
.AddRulesBasedOutputCache()
has optional parameter for inline service configuration.
Another invariant is providing configuration from appsettings.json
file.
Library comes with schema file, that you will be able to select as schema in your own appsettings.json
file.
Configuration parameters:
- OutputCacheEnabled - allows to disable module completely
- DefaultCacheTimeout - default expiration time for your cache entries, if not set up on the rule itself
- CachingRules - array of caching rules the system will have on application startup
- SqlConnectionStringName - optional string parameter, if provided will replace in-memory storage for rules with SQL based. You need to provide only the NAME of connection string, not the connection string itself. Database and/or required table will br created automatically, all the needed migrations will be automatically applied with new versions of library.
- OutputCacheAdminPanelEnabled - enables Admin panel api and access to admin panel page, which is available by url
/rulesBasedCache/adminPanel
Caching rule parameters:
- RuleTemplate - template to be matched in order for rule to become active. Examples:
/test
forExactPath
match rule/test/*
forRegex
match rule.js
forFileExtension
match rule
- RuleAction -
Allow
orDissalow
- RuleType -
ExactPath
,Regex
orFileExtension
- VaryByQueryString - includes query string to cache key
- ResponseExpirationTimeSpan - specific expiration time for rule. TimeSpan format ("00:00:00")
Rules order
Rules have enforced order based on their RuleAction
and RuleType
. <br/>
Main ordering parameter is RuleAction
where Dissallow
has more priority than Allow
. <br/>
Then rules are ordered by RuleType
where priority goes as follows(low to high): FileExtension
, ExactPath
, Regex
. <br/>
Only rule with highest priority will be resolved per request.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net7.0
- IL.Misc (>= 1.0.0)
- Microsoft.EntityFrameworkCore (>= 7.0.11)
- Microsoft.EntityFrameworkCore.SqlServer (>= 7.0.11)
- Microsoft.EntityFrameworkCore.Tools (>= 7.0.11)
- Microsoft.Extensions.DependencyInjection (>= 7.0.0)
- Microsoft.Extensions.Options (>= 7.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.4.3 | 896 | 1/7/2025 |
1.4.2 | 109 | 1/6/2025 |
1.4.1 | 130 | 1/6/2025 |
1.4.0 | 154 | 12/31/2024 |
1.3.1 | 276 | 12/1/2024 |
1.3.0 | 95 | 12/1/2024 |
1.2.1 | 306 | 10/14/2024 |
1.2.0 | 99 | 10/14/2024 |
1.1.4 | 326 | 9/15/2024 |
1.1.3 | 389 | 7/15/2024 |
1.1.2 | 175 | 7/10/2024 |
1.1.1 | 107 | 7/9/2024 |
1.1.0 | 94 | 7/9/2024 |
1.0.19 | 251 | 5/13/2024 |
1.0.18 | 144 | 5/8/2024 |
1.0.17 | 275 | 10/22/2023 |
1.0.15 | 169 | 10/4/2023 |
1.0.9 | 158 | 9/23/2023 |
1.0.4 | 126 | 9/22/2023 |
1.0.3 | 157 | 9/21/2023 |
1.0.2 | 143 | 9/21/2023 |
1.0.1 | 147 | 9/21/2023 |
1.0.0 | 129 | 9/21/2023 |