Struct ritemlcr::Cache [−][src]
A learning cache tracker.
This keeps track of cache blocks.
A cache block represents some data, which is not managed by the cache tracker. The cache block is said to be touched when this data is used in some way.
The ideal replacement is the block which is used in the most distant future. As this is not possible to know in advance, we make a prediction or a approximate ideal replacement, which is based around various data points of the block such as the time of the last uses, or the number of touches.
The aim of the cache tracker is to provided approximate ideal replacements. Numerous algorithms for making these predictions exists (examples are LRU, PLRU, LFU, MFU, MRU, ARC, etc.), but MLCR uses an approach which is radically different: It feeds the data points into a neural network and lets this estimate the tick of the next touch.
Implementations
impl Cache
[src]
pub fn new() -> Cache
[src]
Create a new cache tracker.
pub fn touch(&mut self, id: Id)
[src]
Touch a cache block.
This should be called whenever the object id
represents is used (read, written, etc.).
This will train the neural network with the new data.
pub fn insert(&mut self, id: Id)
[src]
Insert a new cache block into the cache tracker.
pub fn remove(&mut self, id: Id)
[src]
Remove a cache block.
pub fn cold(&mut self) -> ColdIterⓘ
[src]
Get an iterator over blocks from cold to hot.
pub fn trim(&mut self, to: usize) -> Take<ColdIter>
[src]
Get at iterator over blocks to remove to trim the cache tracker to to
.
Note that this won’t remove the blocks, and this should be handled manually with the
remove
method.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl UnwindSafe for Cache
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,