Skip to main content

parse_ttl

Function parse_ttl 

Source
pub fn parse_ttl(literal: &str) -> Result<Duration, TtlParseError>
Expand description

Parse a TTL literal from CACHE TTL '<lit>'.

Accepts <integer><unit> with units s (seconds), m (minutes), h (hours), d (days). Whitespace is not allowed. The integer must be > 0; a zero TTL would mean “expire immediately” which is a foot-gun the parser refuses on the user’s behalf.