pub struct InMemoryLLMCache { /* private fields */ }Expand description
An in-process LLMCache. Unbounded by default; with_capacity evicts the least
recently used response and with_ttl expires responses after a while.
Implementations§
Source§impl InMemoryLLMCache
impl InMemoryLLMCache
pub fn new() -> Self
Sourcepub fn with_capacity(self, capacity: usize) -> Self
pub fn with_capacity(self, capacity: usize) -> Self
Keeps at most capacity responses, evicting the least recently used one.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of stored responses (expired ones included until they are looked up or evicted).
pub fn is_empty(&self) -> bool
pub fn clear(&self)
Trait Implementations§
Source§impl Default for InMemoryLLMCache
impl Default for InMemoryLLMCache
Source§impl LLMCache for InMemoryLLMCache
impl LLMCache for InMemoryLLMCache
Auto Trait Implementations§
impl !Freeze for InMemoryLLMCache
impl RefUnwindSafe for InMemoryLLMCache
impl Send for InMemoryLLMCache
impl Sync for InMemoryLLMCache
impl Unpin for InMemoryLLMCache
impl UnsafeUnpin for InMemoryLLMCache
impl UnwindSafe for InMemoryLLMCache
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
Converts
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> ⓘ
Converts
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