Announcement Announcement Module
No announcement yet.
@Cacheable configurable cache name Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • @Cacheable configurable cache name

    I have 2 identical (in code) DAOs which read data from a set of tables in a database. I have configured 2 beans which read from two different sets of tables and would like to use the @Cacheable annotation for data access and the @CacheEvict annotation for a refresh method to flush all the data (reloads data from the database).

    From the documentation it appears the cache name provided in the 'value' property of the annotation needs to be a constant. However, because I'm using the same class, I cannot use a different constant for each of these DAO - thus 1 DAO will pollute the cache of the other and if either 'refresh' method is called - both DAOs caches will be flushed.

    Is there anyway I can set the cache name at construction time?

    Any help much appreciated!