Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

465 B
Raw Blame
use std::sync::Arc;

pub use crate::BaseCache as Cache;
use crate::{BaseCache, Error};

pub fn get_cache<B: BaseCache>(
    cache: &B,
    key: &str,
    context: &B::Context,
) -> Result<Option<B::Value>, Error> {
    cache.get_cache(key, context)
}

pub fn set_cache<B: BaseCache>(
    cache: &B,
    key: &str,
    value: B::Value,
    context: &B::Context,
) -> Result<(), Error> {
    cache.set_cache(key, value, context)
}

pub type CacheBackend<B> = Arc<B>;