Record Class 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
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a config with the defaults:cacheIntervalsof 10,ttlof 30 minutes,minTokensof 0, and the client's default HTTP options (createHttpOptionsisnull).ContextCacheConfig(int cacheIntervals, Duration ttl, int minTokens) Creates a config that creates caches with the client's default HTTP options.ContextCacheConfig(int cacheIntervals, Duration ttl, int minTokens, @Nullable com.google.genai.types.HttpOptions createHttpOptions) Creates a config. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thecacheIntervalsrecord component.@Nullable com.google.genai.types.HttpOptionsReturns the value of thecreateHttpOptionsrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the TTL in the"<seconds>s"form that the Gemini API uses.final inthashCode()Returns a hash code value for this object.intDeprecated.intReturns the value of theminTokensrecord component.toString()Returns a string representation of this record class.ttl()Returns the value of thettlrecord component.
-
Constructor Details
-
ContextCacheConfig
public ContextCacheConfig(int cacheIntervals, Duration ttl, int minTokens, @Nullable com.google.genai.types.HttpOptions createHttpOptions) Creates a config.- Throws:
IllegalArgumentException- if a value is out of range
-
ContextCacheConfig
public ContextCacheConfig()Creates a config with the defaults:cacheIntervalsof 10,ttlof 30 minutes,minTokensof 0, and the client's default HTTP options (createHttpOptionsisnull). -
ContextCacheConfig
Creates a config that creates caches with the client's default HTTP options.
-
-
Method Details
-
maxInvocations
Deprecated.UsecacheIntervals(), the name ADK Python and ADK Kotlin use.ReturnscacheIntervals(). -
getTtlString
Returns the TTL in the"<seconds>s"form that the Gemini API uses. -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
cacheIntervals
public int cacheIntervals()Returns the value of thecacheIntervalsrecord component.- Returns:
- the value of the
cacheIntervalsrecord component
-
ttl
-
minTokens
-
createHttpOptions
public @Nullable com.google.genai.types.HttpOptions createHttpOptions()Returns the value of thecreateHttpOptionsrecord component.- Returns:
- the value of the
createHttpOptionsrecord component
-
cacheIntervals(), the name ADK Python and ADK Kotlin use.