pub struct ToolResultCache { /* private fields */ }Expand description
Tool result cache with TTL — reduces redundant HTTP/WASM calls.
Implementations§
Source§impl ToolResultCache
impl ToolResultCache
pub fn new(ttl_seconds: u64) -> Self
Sourcepub fn cache_key(tool_name: &str, args: &Value) -> String
pub fn cache_key(tool_name: &str, args: &Value) -> String
Generate a cache key from tool name + hashed args.
Sourcepub fn get(&self, tool_name: &str, args: &Value) -> Option<Value>
pub fn get(&self, tool_name: &str, args: &Value) -> Option<Value>
Get a cached tool result if not expired.
Sourcepub fn set(&self, tool_name: &str, args: &Value, value: &Value)
pub fn set(&self, tool_name: &str, args: &Value, value: &Value)
Store a tool result in the cache.
Sourcepub fn evict_expired(&self)
pub fn evict_expired(&self)
Remove all expired entries.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ToolResultCache
impl RefUnwindSafe for ToolResultCache
impl Send for ToolResultCache
impl Sync for ToolResultCache
impl Unpin for ToolResultCache
impl UnsafeUnpin for ToolResultCache
impl UnwindSafe for ToolResultCache
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
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