记录类:ContextCacheConfig
java.lang.Object
java.lang.Record
com.google.adk.agents.ContextCacheConfig
- Record Components:
cacheIntervals- maximum number of invocations that reuse the same cache before it is refreshed; must be from 1 to 100ttl- time-to-live of the cache; must be a whole number of seconds, at least oneminTokens- minimum prompt token count of the agent's previous request needed to create a cache; raise it to skip small requests, where cache storage can cost more than it saves; must not be negativecreateHttpOptions- HTTP options, such as a timeout, for the call that creates a cache, ornullto use the client's defaults; if that call fails, the request is sent without a cache
-
构造函数概述
ConstructorsConstructorDescription创建一个使用默认值的配置文件:cacheIntervals在 10 个中,ttl持续时间为 30 分钟。minTokens值为 0,以及客户端的默认 HTTP 设置(client’s default HTTP options)。createHttpOptions是null).ContextCacheConfig(int cacheIntervals, Duration ttl, int minTokens) 创建一个配置文件,该配置文件会使用客户端的默认 HTTP 设置来生成缓存。ContextCacheConfig(int cacheIntervals, Duration ttl, int minTokens, @Nullable com.google.genai.types.HttpOptions createHttpOptions) 创建一个配置文件(config.)。 -
方法概述
Modifier and TypeMethodDescriptionint返回该值的值。cacheIntervals“record component”(记录组件)。@Nullable com.google.genai.types.HttpOptions返回该值的值。createHttpOptions“record component”(记录组件)。final boolean用于表示另一个对象是否“等于”当前这个对象。返回该资源的 TTL(“Time To Live”,即“生存时间”)。"<seconds>s"双子座(Gemini)API所使用的表单格式。final inthashCode()返回该对象的哈希码值。int已弃用(Deprecated)。int返回该值的值。minTokens“record component”(记录组件)。toString()返回该记录类的字符串表示形式。ttl()返回该值的值。ttl“record component”(记录组件)。
-
构造函数详细信息
-
ContextCacheConfig
public ContextCacheConfig(int cacheIntervals, Duration ttl, int minTokens, @Nullable com.google.genai.types.HttpOptions createHttpOptions) 创建一个配置文件(config.)。- Throws:
IllegalArgumentException- if a value is out of range
-
ContextCacheConfig
public ContextCacheConfig()创建一个使用默认值的配置文件:cacheIntervals在 10 个中,ttl持续时间为 30 分钟。minTokens值为 0,以及客户端的默认 HTTP 设置(client’s default HTTP options)。createHttpOptions是null). -
ContextCacheConfig
创建一个配置文件,该配置文件会使用客户端的默认 HTTP 设置来生成缓存。
-
-
方法详细信息(Method Details)
-
maxInvocations
Deprecated.UsecacheIntervals(), the name ADK Python and ADK Kotlin use.返回值cacheIntervals(). -
getTtlString
返回该资源的 TTL(“Time To Live”,即“生存时间”)。"<seconds>s"双子座(Gemini)API所使用的表单格式。 -
toString
-
hashCode
-
equals
用于判断另一个对象是否“等于”当前对象。当另一个对象属于相同的类,并且所有记录组件都相同时,这两个对象才被认为是相等的。其中,某些特定的组件(称为“引用组件”)也需要被进行比较。Objects::equals(Object,Object);原始组件(primitive components)会与……进行比较。compare这些方法来自它们对应的包装类(wrapper classes)。 -
cacheIntervals
public int cacheIntervals()返回该值的值。cacheIntervals“record component”(记录组件)。- Returns:
- the value of the
cacheIntervalsrecord component
-
ttl
-
minTokens
-
createHttpOptions
public @Nullable com.google.genai.types.HttpOptions createHttpOptions()返回该值的值。createHttpOptions“record component”(记录组件)。- Returns:
- the value of the
createHttpOptionsrecord component
-
cacheIntervals()这些名称(ADK Python 和 ADK Kotlin)被用于相应的开发工具包中。