Annotation Interface Cache


@Target(METHOD) @Retention(RUNTIME) public @interface Cache
Annotation indicating that the result of the method will be cached and reused in future calls.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Key of the cache in which result is stored.
    int
    Retention time (in seconds).
  • Element Details

    • key

      String key
      Key of the cache in which result is stored.
      Returns:
      Key of the cache in which result is stored
      Default:
      "{class}::{method}"
    • timeToLive

      int timeToLive
      Retention time (in seconds).
      Returns:
      Retention time (in seconds).
      Default:
      -1