Skip to main content

Ttl

Trait Ttl 

Source
pub trait Ttl {
    // Required method
    fn remaining(&self) -> Duration;
}
Expand description

Implemented by cache values that know how long they have left to live.

TtlLifecycle uses this to decide whether an entry is still fresh during Lifecycle::evaluate. A value that returns Duration::ZERO is treated as expired and will be evicted the next time the sieve hand reaches it.

Note that you may be asked multiple times about the same key even if you say zero.

Required Methods§

Source

fn remaining(&self) -> Duration

How much time the value has left. Duration::ZERO means expired.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§