缓存元数据
Metadata for the context cache associated with LLM responses.
This stores cache identification, usage tracking, and lifecycle information for a particular cache instance. It can be in one of two states:
Active cache state: cacheName is set and expireTime, invocationsUsed, and createdAt are populated.
Fingerprint-only state: cacheName is
nulland only fingerprint and contentsCount are set, used for prefix matching before a cache exists.
Token counts (cached and total) are available in LlmResponse.usageMetadata and should be accessed from there to avoid duplication.
构造函数(Constructors)
类型
Fluent Builder for CacheMetadata该功能主要为 Java 语言的调用者提供支持;如果某个属性未被设置,其值将默认使用构造函数中指定的默认值。
属性(Properties)
内容数量:当存在有效的缓存时,该数值表示已缓存的内容数量;否则,该数值表示用于内容识别的可缓存内容前缀的数量。该数值必须为非负数。
缓存创建时的时间(以毫秒为单位)。 null 当没有活动的缓存存在时,系统会读取 ADK Python 提供的“小数秒级时间戳”(即以秒为单位的精确时间值)。
缓存是否会在指定的时间内过期? EXPIRY_BUFFER. 总是 false 对于仅包含指纹信息的元数据(这类元数据不包含其他任何内容),…… expireTime).
缓存失效的时间(以毫秒为单位)。 null 当没有活动的缓存存在时,系统会读取 ADK Python 提供的“小数秒级时间戳”(即以秒为单位的精确时间值)。
可缓存内容的哈希值(系统指令 + 工具 + 内容)。该哈希值始终存在,用于前缀匹配(prefix matching)。
该缓存被调用的次数。 null 当不存在任何有效的缓存时(即没有正在使用的缓存数据时),该值必须被设置为非负数。