Closed Crozin closed 6 years ago
Thank you for your comment. Surely this can be opened up. I will do that and make a release quickly just to expose it.
Fixed and version 1.3 released to Nuget
Hey, I see Client-side of CacheCow has been upgraded, however what I was asking about was Server-side part. :-)
Any chace to reopen that Issue as it targets CacheCow.Server not CacheCow.Client? :)
Sorry sure. Let me look at it.
Hi @aliostad,
Does it make sense to add the same functionality to the server-side cachinghandler?
For example:
diff --git a/src/CacheCow.Server/CachingHandler.cs b/src/CacheCow.Server/CachingHandler.cs
index 7f8987e..b574a67 100644
--- a/src/CacheCow.Server/CachingHandler.cs
+++ b/src/CacheCow.Server/CachingHandler.cs
@@ -155,6 +155,11 @@ EntityTagHeaderValue> ETagValueGenerator
public static Action<Exception> IgnoreExceptionPolicy { get; private set; }
/// <summary>
+ /// Rules by which requests get ignored for caching
+ /// </summary>
+ public Func<HttpRequestMessage, bool> IgnoreRequestRules { get; set; }
+
+ /// <summary>
/// Provides route pattern and linked route pattern
/// </summary>
public IRoutePatternProvider RoutePatternProvider
@@ -237,6 +242,11 @@ protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage reques
try
{
+ if (IgnoreRequestRules != null && IgnoreRequestRules(request))
+ {
+ return base.SendAsync(request, cancellationToken);
+ }
+
// do the expiry
CheckExpiry(request);
OK, CacheCow is moving away from all that IRoutePatternProvider, and EntityTagStore. 2.0.0 is being released in a few days.
Hello. Are there any plans to add support for attribute/pattern-based option to explicitly include/exclude specific WebAPI actions in CacheCow Handler? It alread has
_ignoreRequestRules
but there is no way to extend/replace that filed.Why do I ask for such an option? Sometimes only 1 or 2 actions could benefit HTTP Cache and there is no need to flood Redis or other storage with useless entries.