Annotation Type CacheEvict


@Retention(CLASS) @Target(METHOD) public @interface CacheEvict

Removes an entry from the cache when the method returns -- Spring's @CacheEvict.

Keys and names are as Cacheable describes. A method that throws evicts nothing unless beforeInvocation() says to evict first.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Removes every entry of the cache rather than one.
    boolean
    Evicts before the method runs, so even a call that throws evicts.
    The same as value(), as Spring spells it.
    The key expression; see Cacheable.
    The cache's name; the first is used when several are given.
  • Element Details

    • value

      String[] value
      The cache's name; the first is used when several are given.
      Default:
      {}
    • cacheNames

      String[] cacheNames
      The same as value(), as Spring spells it.
      Default:
      {}
    • key

      String key
      The key expression; see Cacheable. Ignored with allEntries().
      Default:
      ""
    • allEntries

      boolean allEntries
      Removes every entry of the cache rather than one.
      Default:
      false
    • beforeInvocation

      boolean beforeInvocation
      Evicts before the method runs, so even a call that throws evicts.
      Default:
      false