Crates.io | ritemlcr |
lib.rs | ritemlcr |
version | 0.1.0 |
source | src |
created_at | 2021-03-26 17:46:34.720975 |
updated_at | 2021-03-26 17:46:34.720975 |
description | An adaptive machine-learning-based cache tracker/replacement policy. From ticki's tfs/mlcr. |
homepage | |
repository | https://github.com/ritedb/ritenn |
max_upload_size | |
id | 373906 |
size | 19,246 |
MLCR: Machine-Learning-based Cache Replacement
MLCR trains a neural network to "guess" how long time will pass before the cache block is accessed again. In other words, it provides a qualified guess to approximate the ideal Bélády's algorithm without a time machine.
MLCR is slow, because it needs to train a neural network, but in many cases, the added precision pays off by greatly reducing the number of cache misses. As such, it should only be used when the cached medium is significantly slower than training the network (e.g. hard disks or internet downloads).
let mut cache = ritemlcr::Cache::new();
cache.insert(1);
cache.insert(2);
cache.insert(3);
cache.insert(4);
cache.insert(100);
cache.insert(200);
cache.touch(100);
cache.touch(100);
cache.touch(1);
cache.touch(2);
cache.touch(2);
cache.touch(2);
It is a fork of the crate mlcr , but some adjustments and improvements have been made to the code .
This library is licensed under either of:
at your option.