#[non_exhaustive]pub enum CacheControl {
Ephemeral,
EphemeralWithTtl(Duration),
}Expand description
Cache breakpoint placed on a content block, system prompt block, or
tool definition. Providers that support prompt caching (Anthropic
today) read these to decide which prefix is cacheable and at what
TTL; providers without explicit caching ignore the field. The
presence of cache_control only declares intent — the actual cache
hit/miss is reported via crate::Usage::cached_input_tokens and
the cache-creation counters.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Ephemeral
Ephemeral cache with the provider’s default TTL (5 minutes on
Anthropic). Equivalent to omitting ttl on the wire.
EphemeralWithTtl(Duration)
Ephemeral cache with an explicit TTL. Anthropic accepts only
5m and 1h; the adapter rounds to the nearest supported value
and warns if neither fits cleanly.
Trait Implementations§
Source§impl Clone for CacheControl
impl Clone for CacheControl
Source§fn clone(&self) -> CacheControl
fn clone(&self) -> CacheControl
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 CacheControl
impl Debug for CacheControl
Source§impl PartialEq for CacheControl
impl PartialEq for CacheControl
Source§fn eq(&self, other: &CacheControl) -> bool
fn eq(&self, other: &CacheControl) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for CacheControl
impl StructuralPartialEq for CacheControl
Auto Trait Implementations§
impl Freeze for CacheControl
impl RefUnwindSafe for CacheControl
impl Send for CacheControl
impl Sync for CacheControl
impl Unpin for CacheControl
impl UnsafeUnpin for CacheControl
impl UnwindSafe for CacheControl
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