Announcement Announcement Module
No announcement yet.
Caching collections and items Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Caching collections and items


    I think the most typical cache scenario is the scenario where you want to cache collections of entities. If the collection of entities varies but there are a lot of common entities in each collection, you would typically want the collection cache to cache the (cache) ids of the entities and the entity cache store the entities themselves.

    The collection cache queries the entity cache for entities based on ids. On an individual basis these entities might need to be refreshed and by keeping these caches separate and "smart" this is possible. Whenever the collection cache tries to retrieve an entity from the entity cache that is not there, the repository is queried to supply the missing entity.

    I don't see how I can easily achieve this scenario with Spring. And it would make such a huge impact if I could. Will this scenario become possible as JCache is implemented or is it already and I'm just not seeing it? The current @Cacheable and @CacheEvict annotations seem incredibly static.