Open Closed

ABP 9+ Entity Cache #10458


User avatar
0
DominaTang created

I noticed that ABP 9 introduced "Entity Cache", if a an Entity has navigation properties, for example, a Product has a list of Orders. If I register Product for entity cache, when Order is changed or added to the product, would the cached product has latest orders list?


1 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    • ABP’s Entity Cache caches one entity instance by its key, and it is automatically invalidated only when that same entity is updated or deleted (so it can be reloaded from the database on the next request).
    • Therefore, if you cache Product and later an Order is added/updated/removed, the cached Product entry is not automatically refreshed just because a related entity changed. You should assume the cached Product may have a stale navigation collection (e.g., Product.Orders) until the Product cache entry is explicitly invalidated or the Product itself is updated/deleted.
    • Practical guidance:
      • Prefer caching entities that are used mostly as read-only reference data (or that don’t depend on frequently-changing navigation graphs).
      • If you need “Product with latest Orders” semantics, don’t rely on Product entity cache for the navigation list; instead query Orders separately (or implement your own invalidation strategy when Order changes, e.g., publish an event and remove the related Product cache entry).

    (verified) https://abp.io/docs/latest/framework/infrastructure/entity-cache


    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.2.0-preview. Updated on February 17, 2026, 09:10
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.