pub struct ProviderCache { /* private fields */ }Expand description
Provider response caching wrapper
Implementations§
Source§impl ProviderCache
impl ProviderCache
Sourcepub fn new(cache_dir: &Path) -> Result<Self, Box<dyn Error>>
pub fn new(cache_dir: &Path) -> Result<Self, Box<dyn Error>>
Create new provider response cache
Sourcepub fn get_response(
&self,
provider: &str,
model: &str,
prompt: &str,
) -> Result<Option<String>, Box<dyn Error>>
pub fn get_response( &self, provider: &str, model: &str, prompt: &str, ) -> Result<Option<String>, Box<dyn Error>>
Get cached provider response
Sourcepub fn cache_response(
&self,
provider: &str,
model: &str,
prompt: &str,
response: &str,
) -> Result<(), Box<dyn Error>>
pub fn cache_response( &self, provider: &str, model: &str, prompt: &str, response: &str, ) -> Result<(), Box<dyn Error>>
Cache provider response
Sourcepub fn stats(&self) -> &CacheStats
pub fn stats(&self) -> &CacheStats
Get cache statistics
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