Enum Class AnthropicCacheType

java.lang.Object
java.lang.Enum<AnthropicCacheType>
org.springframework.ai.anthropic.api.AnthropicCacheType
All Implemented Interfaces:
Serializable, Comparable<AnthropicCacheType>, Constable

public enum AnthropicCacheType extends Enum<AnthropicCacheType>
Cache types supported by Anthropic's prompt caching feature.

Prompt caching allows reusing frequently used prompts to reduce costs and improve response times for repeated interactions.

Author:
Claudio Silva Junior, Soby Chacko, Austin Dase
See Also:
  • Enum Constant Details

    • EPHEMERAL

      public static final AnthropicCacheType EPHEMERAL
      Ephemeral cache with 5-minute lifetime, refreshed on each use.
  • Method Details

    • values

      public static AnthropicCacheType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static AnthropicCacheType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • cacheControl

      Returns a new CacheControl instance for this cache type.
      Returns:
      a CacheControl instance configured for this cache type
    • cacheControl

      Returns a new CacheControl instance for this cache type with the specified TTL.
      Parameters:
      ttl - the time-to-live for the cache entry (e.g., "5m" for 5 minutes, "1h" for 1 hour)
      Returns:
      a CacheControl instance configured for this cache type and TTL