Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-10778

Allow dynamic values in @Cacheable and @CacheEvict

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 3.1.4
    • Fix Version/s: None
    • Component/s: Caching
    • Last commented by a User:
      false

      Description

      @Cacheable and @CacheEvict only take a constant value for the cache names. Allow it to be a dynamic value: class field, value from properties file eg ${myProperty} like in @Value or a SpEL expression.

      In case of abstract classes that implement methods that should be cached but each subclass should use a different cache name. This is not possible currently and hence such methods can not be put into an abstract class even though all subclasses use exactly the same method.

        Attachments

          Activity

            People

            • Assignee:
              snicoll Stéphane Nicoll
              Reporter:
              beginner_ Thomas Struntz
              Last updater:
              Stéphane Nicoll
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                2 years, 34 weeks, 5 days ago