Skip to main content

cache_key

Function cache_key 

Source
pub fn cache_key(prompt: &str) -> String
Expand description

Generate a stable cache key from a prompt string.

Uses DefaultHasher (non-cryptographic, non-deterministic across processes on Rust 1.36+). For cross-process or cross-restart cache sharing, prefer crate::enhanced::dedup_key which uses FNV-1a with a fixed seed.

§Arguments

  • prompt — The raw prompt text.

§Returns

A "prompt:<hex>" string suitable as a cache key.

§Examples

use tokio_prompt_orchestrator::enhanced::cache_key;

let k = cache_key("hello world");
assert!(k.starts_with("prompt:"));