3

I have the following caching attribute on my controller method:

 [CacheOutput(ClientTimeSpan = 14400, ServerTimeSpan = 14400)]

I am attempting to clear the cache. However, after running this line of code:

 //clear cache   
 cache.RemoveStartsWith(Configuration.CacheOutputConfiguration().MakeBaseCachekey("BeamsController", "Get"));

I am still getting a 304 not-modified response without the controller method being invoked.

I am using this library https://github.com/filipw/AspNetWebApi-OutputCache

1 Answer 1

3
 [InvalidateCacheOutput("Get", typeof(BeamsController))] 

seems to work, instead of 'manual invalidation' (RemoveStartsWith), above.

In fact, after reading the source code of the attribute, it appears that the documentation is wrong and it should be:

cache.RemoveStartsWith(Configuration.CacheOutputConfiguration().MakeBaseCachekey("Beams", "Get"));

which works as expected, calling the method.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.