Git Product home page Git Product logo

Comments (5)

LockTar avatar LockTar commented on June 2, 2024

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.

moonpyk avatar moonpyk commented on June 2, 2024

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.

LockTar avatar LockTar commented on June 2, 2024

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.

moonpyk avatar moonpyk commented on June 2, 2024

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.

LockTar avatar LockTar commented on June 2, 2024

Well it's working for now with a workaround so no critical bug :).
Thanks for the feedback.

from mvcdonutcaching.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.