pub enum PromptCachePolicy {
OpenAiCompatible,
Anthropic,
OpenRouter,
Gemini,
LocalPrefix,
}Expand description
How a provider reuses prompt prefixes / KV cache.
Selected by the provider implementation, never by parsing provider.name().
Variants§
OpenAiCompatible
Chat Completions prompt_cache_key (OpenAI, Azure, Mistral, NVIDIA, vLLM).
Anthropic
Anthropic Claude: explicit cache_control breakpoints + TTL.
OpenRouter
OpenRouter: Anthropic-style cache_control plus prompt_cache_key/session_id.
August 2026: OpenRouter translates cache_control ↔ prompt_cache_breakpoint
per upstream. Sticky routing uses session_id (falls back to prompt_cache_key).
Gemini
Gemini 2.5+: implicit prefix cache and/or cachedContents.
LocalPrefix
Ollama / llama.cpp: engine-side prefix reuse only when tokens match.
Trait Implementations§
Source§impl Clone for PromptCachePolicy
impl Clone for PromptCachePolicy
Source§fn clone(&self) -> PromptCachePolicy
fn clone(&self) -> PromptCachePolicy
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 moreimpl Copy for PromptCachePolicy
Source§impl Debug for PromptCachePolicy
impl Debug for PromptCachePolicy
impl Eq for PromptCachePolicy
Source§impl PartialEq for PromptCachePolicy
impl PartialEq for PromptCachePolicy
impl StructuralPartialEq for PromptCachePolicy
Auto Trait Implementations§
impl Freeze for PromptCachePolicy
impl RefUnwindSafe for PromptCachePolicy
impl Send for PromptCachePolicy
impl Sync for PromptCachePolicy
impl Unpin for PromptCachePolicy
impl UnsafeUnpin for PromptCachePolicy
impl UnwindSafe for PromptCachePolicy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.