generate_cache_key

Function generate_cache_key 

Source
pub fn generate_cache_key(request: &CacheableRequest) -> String
Expand description

Generate a cache key from a request using SHA-256

The key includes:

  • Model name
  • Prompt content
  • Temperature (normalized to 2 decimal places)
  • Max tokens
  • All additional parameters (sorted for consistency)

§Performance

  • Target: <100μs for typical requests
  • SHA-256 is hardware-accelerated on most modern CPUs