Comments (5)
Finally found the solution. The area is ignored in the url for removing the child action. This is different then the default OutputCache attribute. I think this is a bug?
So the solution is:
cacheManager.RemoveItem("News", "LastArticles", new { numberOfArticles = 2 });
See for more information this StackOverlow question.
from mvcdonutcaching.
Thanks for reporting, I know exactly what happens.
When generating the cache key during action invocation, the default keybuilder only builds an area key component if the area is not null or empty.
By calling RemoveItem[s] with an area component set to empty, the area key component shouldn't be built either, otherwise no key will match for removal
from mvcdonutcaching.
Thank you for your reply.
So if I understand it right, this is by design? Does this effect other NewsControllers with Action LastArticles in other Area's?
from mvcdonutcaching.
Nope this is a bug, the area part should be ignored if empty for removal action.
Thus, the normal behaviour would be to remove the area impacted keys. This is what you are doing by calling cacheManager.RemoveItem("News", "LastArticles", new { numberOfArticles = 2 });
Generally speaking it's a bad idea to have controllers with the same name in different areas, we got problems in the past with that (not related to DonutCaching).
The solution we adopted was to prefix our area controllers with the area name itself, making url routing tweaks afterwards to hide the redundancy.
eg NewsController and AdminNewsController in the Admin area + route tweaks to avoid /Admin/AdminNews and have /Admin/News routes instead.
from mvcdonutcaching.
Well it's working for now with a workaround so no critical bug :).
Thanks for the feedback.
from mvcdonutcaching.
Related Issues (20)
- help,if custom RouteConfig,the 'area' parameter not work in asp.net mvc HOT 5
- Sometimes application cache throws System.Web.HttpException HOT 2
- Clear cache with return View doesn't work HOT 1
- FileResult getting corrupted
- Server crash on creating cache item
- MvcDonutCaching doesn't work on ChildActions? HOT 5
- Cache expiry policy
- Missing null check in KeyGenerator.cs HOT 2
- Not working with route attribute
- abstract controller class derived as regular controllers in two different areas hits same cache
- Filtering is not allowed. While implementing Donut Caching.
- getting "Object reference not set to an instance of an object" while generating a key HOT 1
- cache only non-authenticated pages HOT 2
- Serialization error when trying to pass model object to child action using action method extension of Donutcache HOT 1
- unnecessary Comments were adding HOT 2
- Order of route values shouldn't impact key built HOT 1
- Can i change input database of mvcdonutcaching?
- RemoveItems does not pass routeValues to build the key causing RemoveItems to fail
- Cache profile Server, but still different results on different browsers/machines
- Asp.net Core Support HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mvcdonutcaching.