pub struct ContextCacheConfig {
pub min_tokens: u32,
pub ttl_seconds: u32,
pub cache_intervals: u32,
}Expand description
Configuration for automatic prompt caching lifecycle management.
When set on runner configuration, the runner will automatically create and manage cached content resources for supported providers (currently Gemini).
§Example
use adk_core::ContextCacheConfig;
let config = ContextCacheConfig {
min_tokens: 4096,
ttl_seconds: 600,
cache_intervals: 3,
};
assert_eq!(config.min_tokens, 4096);Fields§
§min_tokens: u32Minimum system instruction + tool token count to trigger caching. Set to 0 to disable caching.
ttl_seconds: u32Cache time-to-live in seconds. Set to 0 to disable caching.
cache_intervals: u32Maximum number of LLM invocations before cache refresh. After this many invocations, the runner creates a new cache and deletes the old one.
Trait Implementations§
Source§impl Clone for ContextCacheConfig
impl Clone for ContextCacheConfig
Source§fn clone(&self) -> ContextCacheConfig
fn clone(&self) -> ContextCacheConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContextCacheConfig
impl Debug for ContextCacheConfig
Source§impl Default for ContextCacheConfig
impl Default for ContextCacheConfig
Source§impl<'de> Deserialize<'de> for ContextCacheConfig
impl<'de> Deserialize<'de> for ContextCacheConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ContextCacheConfig
impl RefUnwindSafe for ContextCacheConfig
impl Send for ContextCacheConfig
impl Sync for ContextCacheConfig
impl Unpin for ContextCacheConfig
impl UnsafeUnpin for ContextCacheConfig
impl UnwindSafe for ContextCacheConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more