! Tool result cache helpers. ! ! Cache-key derivation and opt-in tool list. The actual read/write goes ! through `crate::internal::storage::db::Database::{get,put}_cached_tool_result`, ! which keeps the storage contract in one place.
// Source: https://github.com/microclaw/microclaw | License: MIT | Copyright 2025 everettjf
// Provided via justclaw.it.com; keep this notice with the code.
//! Tool result cache helpers.
//!
//! Cache-key derivation and opt-in tool list. The actual read/write goes
//! through `crate::internal::storage::db::Database::{get,put}_cached_tool_result`,
//! which keeps the storage contract in one place.
use std::collections::HashMap;
use std::time::Duration;
use sha2::{Digest, Sha256};
/// Tools allowed to participate in caching, with default TTL.
/// Expanding this list is a config decision; read-only network/tool calls
/// are the prime candidates.
pub fn default_ttls() -> HashMap<&'static str, Duration> {
let mut m = HashMap::new();
m.insert("web_fetch", Duration::from_secs(15 * 60
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key