pub struct CachePolicy {
pub key_func: Option<Arc<dyn Fn(&CacheKeyInput) -> String + Send + Sync>>,
}Expand description
Cache policy for LLM response caching
Fields§
§key_func: Option<Arc<dyn Fn(&CacheKeyInput) -> String + Send + Sync>>Custom cache key generation function
Implementations§
Source§impl CachePolicy
impl CachePolicy
Sourcepub fn with_key_func(
self,
f: Arc<dyn Fn(&CacheKeyInput) -> String + Send + Sync>,
) -> Self
pub fn with_key_func( self, f: Arc<dyn Fn(&CacheKeyInput) -> String + Send + Sync>, ) -> Self
Set custom cache key function
Sourcepub fn generate_key(&self, input: &CacheKeyInput) -> String
pub fn generate_key(&self, input: &CacheKeyInput) -> String
Generate cache key from input
Trait Implementations§
Source§impl Clone for CachePolicy
impl Clone for CachePolicy
Source§fn clone(&self) -> CachePolicy
fn clone(&self) -> CachePolicy
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 moreSource§impl Default for CachePolicy
impl Default for CachePolicy
Source§fn default() -> CachePolicy
fn default() -> CachePolicy
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for CachePolicy
impl !UnwindSafe for CachePolicy
impl Freeze for CachePolicy
impl Send for CachePolicy
impl Sync for CachePolicy
impl Unpin for CachePolicy
impl UnsafeUnpin for CachePolicy
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