pub struct ProviderCache { /* private fields */ }Expand description
Provider response cache
Caches AI provider responses to improve performance and reduce API calls. Uses SHA256 hash of request to create cache keys.
Implementations§
Source§impl ProviderCache
impl ProviderCache
Sourcepub fn get(
&self,
provider: &str,
model: &str,
request: &ChatRequest,
) -> Result<Option<ChatResponse>, ProviderError>
pub fn get( &self, provider: &str, model: &str, request: &ChatRequest, ) -> Result<Option<ChatResponse>, ProviderError>
Sourcepub fn set(
&self,
provider: &str,
model: &str,
request: &ChatRequest,
response: &ChatResponse,
) -> Result<(), ProviderError>
pub fn set( &self, provider: &str, model: &str, request: &ChatRequest, response: &ChatResponse, ) -> Result<(), ProviderError>
Sourcepub fn invalidate(
&self,
provider: &str,
model: &str,
request: &ChatRequest,
) -> Result<bool, ProviderError>
pub fn invalidate( &self, provider: &str, model: &str, request: &ChatRequest, ) -> Result<bool, ProviderError>
Sourcepub fn clear(&self) -> Result<(), ProviderError>
pub fn clear(&self) -> Result<(), ProviderError>
Sourcepub fn cleanup_expired(&self) -> Result<usize, ProviderError>
pub fn cleanup_expired(&self) -> Result<usize, ProviderError>
Auto Trait Implementations§
impl Freeze for ProviderCache
impl RefUnwindSafe for ProviderCache
impl Send for ProviderCache
impl Sync for ProviderCache
impl Unpin for ProviderCache
impl UnwindSafe for ProviderCache
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