get_if_valid

Function get_if_valid 

Source
pub fn get_if_valid(key: &str, max_age: u32) -> Option<String>
Expand description

Retrieve content from the in-memory cache if it exists and is not expired

§Arguments

  • key - Cache key (usually a path or URL)
  • max_age - Maximum age in seconds

§Returns

  • Some(String) - Content was found and is not expired
  • None - Content was not found or is expired