pub trait CacheableTool: Tool {
// Provided methods
fn cache_key(&self, args: &Value) -> String { ... }
fn should_cache(&self, _args: &Value) -> bool { ... }
fn cache_ttl(&self) -> u64 { ... }
}Expand description
Trait for caching tool results
Provided Methods§
Sourcefn cache_key(&self, args: &Value) -> String
fn cache_key(&self, args: &Value) -> String
Generate cache key for given arguments.
Default implementation combines the tool name with a hash of the
serialized arguments. The key is stable within a single process
run but may differ across restarts (uses DefaultHasher). Override
for tools that need a custom key strategy.
Sourcefn should_cache(&self, _args: &Value) -> bool
fn should_cache(&self, _args: &Value) -> bool
Check if result should be cached
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".