Class CacheMetadata

java.lang.Object
com.google.adk.JsonBaseModel
com.google.adk.models.CacheMetadata

public abstract class CacheMetadata extends JsonBaseModel
Context cache state carried on an LLM response, and on its event, from one request to the next.

Metadata for an active cache has a cacheName(), expireTime() and invocationsUsed(). Fingerprint-only metadata has none of them: it records the cacheable prefix so that a later request can tell whether the prefix is still the same.

  • Method Details

    • fingerprint

      public abstract String fingerprint()
      Hash of the cacheable state: system instruction, tools and the cached leading contents.
    • contentsCount

      public abstract int contentsCount()
      Number of leading contents in the cache, or in the fingerprint when no cache is active.
    • cacheName

      public abstract Optional<String> cacheName()
      Full resource name of the cached content; empty when no cache is active.
    • expireTime

      public abstract Optional<Instant> expireTime()
      When the cache expires; empty when no cache is active.
    • invocationsUsed

      public abstract Optional<Integer> invocationsUsed()
      Number of invocations that have used the cache; empty when no cache is active.
    • createdAt

      public abstract Optional<Instant> createdAt()
      When the cache was created; empty when no cache is active.
    • toBuilder

      public abstract CacheMetadata.Builder toBuilder()
    • builder

      public static CacheMetadata.Builder builder()
    • toString

      public final String toString()
      Returns a short description for logs, in the same shape as ADK Python's.
      Overrides:
      toString in class Object