Entry

Trait Entry 

Source
pub trait Entry {
    type Rank: Ord;

    // Required methods
    fn rank(&self) -> Self::Rank;
    fn accessed(&self) -> bool;
}
Expand description

The Second Chance implementation works with a set of entries; each entry keeps track of a value that represents its rank in the set, and a single boolean flag, to determine whether the entry has been accessed since the last time it was scanned (and move up in rank).

Required Associated Types§

Source

type Rank: Ord

The Second Chance policy maintains an implicit list of entries. Entries in the list are ordered by sorting by Rank; a lower rank comes earlier in the list of removal victims.

For files, this would be SystemTime or FileTime: files with more recent modification times come later in the eviction queue.

Required Methods§

Source

fn rank(&self) -> Self::Rank

Returns the rank value for this entry.

For file, this would be the file’s modification time.

Source

fn accessed(&self) -> bool

Returns whether the entry was accessed since it last entered or was moved back in the list of candidates for removal.

For files, this is true if the access time is strictly greater than the modification time.

Implementors§