Skip to main content

ResponseCache

Trait ResponseCache 

Source
pub trait ResponseCache: Send + Sync {
    // Required methods
    fn get(&self, key: &str) -> Option<String>;
    fn put(&self, key: String, value: String);
    fn clear(&self);
}
Expand description

LLM result cache abstraction.

Values are carried as strings (internally a serialized AgentOutput); the implementation can be swapped for disk / Redis / cross-process sharing as long as get/put semantics stay consistent.

Required Methods§

Source

fn get(&self, key: &str) -> Option<String>

Returns the serialized result for key, if cached.

Source

fn put(&self, key: String, value: String)

Writes a cache entry.

Source

fn clear(&self)

Clears the cache.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§