Class CacheMetadata
java.lang.Object
com.google.adk.JsonBaseModel
com.google.adk.models.CacheMetadata
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.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic CacheMetadata.Builderbuilder()Full resource name of the cached content; empty when no cache is active.abstract intNumber of leading contents in the cache, or in the fingerprint when no cache is active.When the cache was created; empty when no cache is active.When the cache expires; empty when no cache is active.abstract StringHash of the cacheable state: system instruction, tools and the cached leading contents.Number of invocations that have used the cache; empty when no cache is active.abstract CacheMetadata.Builderfinal StringtoString()Returns a short description for logs, in the same shape as ADK Python's.Methods inherited from class JsonBaseModel
fromJsonNode, fromJsonString, getMapper, toJson, toJsonNode, toJsonStringModifier and TypeMethodDescriptionstatic <T extends JsonBaseModel>
TfromJsonNode(com.fasterxml.jackson.databind.JsonNode jsonNode, Class<T> clazz) Deserializes a JsonNode to an object of the given type.static <T extends JsonBaseModel>
TfromJsonString(String jsonString, Class<T> clazz) Deserializes a Json string to an object of the given type.static com.fasterxml.jackson.databind.ObjectMapperReturns the mutable ObjectMapper instance used by ADK.toJson()Serializes this object (i.e., the ObjectMappper instance used by ADK) to a Json string.protected static com.fasterxml.jackson.databind.JsonNodetoJsonNode(Object object) Serializes an object to a JsonNode.static StringtoJsonString(Object object) Serializes an object to a Json string.
-
Method Details
-
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
-
expireTime
-
invocationsUsed
-
createdAt
-
toBuilder
-
builder
-
toString
-