pub struct L3LlmCache { /* private fields */ }Expand description
L3: LLM response cache — exact prompt→response to avoid duplicate API calls.
Implementations§
Source§impl L3LlmCache
impl L3LlmCache
pub fn new() -> Self
Sourcepub fn set(&self, prompt_hash: &str, entry: LlmCacheEntry, ttl: Duration)
pub fn set(&self, prompt_hash: &str, entry: LlmCacheEntry, ttl: Duration)
Cache a prompt→response pair.
Sourcepub fn get(&self, prompt_hash: &str) -> Option<LlmCacheEntry>
pub fn get(&self, prompt_hash: &str) -> Option<LlmCacheEntry>
Look up a cached response by prompt hash.
Sourcepub fn total_cost_saved(&self) -> f64
pub fn total_cost_saved(&self) -> f64
Get total cost saved by cache hits.
pub fn clear(&self)
pub fn stats(&self) -> CacheStats
Trait Implementations§
Source§impl Clone for L3LlmCache
impl Clone for L3LlmCache
Source§fn clone(&self) -> L3LlmCache
fn clone(&self) -> L3LlmCache
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 L3LlmCache
impl Debug for L3LlmCache
Source§impl Default for L3LlmCache
impl Default for L3LlmCache
Source§fn default() -> L3LlmCache
fn default() -> L3LlmCache
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for L3LlmCache
impl RefUnwindSafe for L3LlmCache
impl Send for L3LlmCache
impl Sync for L3LlmCache
impl Unpin for L3LlmCache
impl UnsafeUnpin for L3LlmCache
impl UnwindSafe for L3LlmCache
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