pub struct AutoCache {
pub ttl: Duration,
pub implicit_floor: u64,
pub implicit_ceiling: u64,
pub min_tokens: u64,
pub min_gain: u64,
pub cached_ratio: f64,
pub storage_ratio_per_hour: f64,
}Expand description
The Auto policy’s parameters. The price ratios default to
gemini-3.8-flash standard prices relative to its input price (cached read
$0.075 and storage $0.50 per 1M tokens per hour, against $0.75 input);
AutoCache::for_spec reads the cached-read ratio of another model
from its catalog spec. The catalog holds no storage price.
Fields§
§ttl: DurationThe shortest TTL a new cache gets. A cache that would come within 5 seconds of expiry before its next expected call is not created.
implicit_floor: u64Smallest request implicit caching serves (4,096 tokens on Gemini 3).
implicit_ceiling: u64Above this many cacheable tokens the book sends requests inline and lets implicit caching serve them, until implicit caching is seen failing.
min_tokens: u64Gemini’s minimum cache size.
min_gain: u64The fewest tokens a new cache must add over the one it replaces.
cached_ratio: f64Cached-read price over input price.
storage_ratio_per_hour: f64Storage price per hour over input price.
Implementations§
Trait Implementations§
impl Copy for AutoCache
impl StructuralPartialEq for AutoCache
Auto Trait Implementations§
impl Forget for AutoCache
impl Freeze for AutoCache
impl Move for AutoCache
impl RefUnwindSafe for AutoCache
impl Send for AutoCache
impl Sync for AutoCache
impl Unpin for AutoCache
impl UnsafeUnpin for AutoCache
impl UnwindSafe for AutoCache
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more