src/backup/dynamic_index.rs: Add LruCache for chunks.

In order to improve non-sequential reads of chunks as e.g. in FUSE.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner
2020-02-27 15:56:28 +01:00
committed by Dietmar Maurer
parent 35ddf0b419
commit 536683e73b
2 changed files with 27 additions and 9 deletions

View File

@ -100,6 +100,8 @@ pub struct LruCache<K, V> {
_marker: PhantomData<Box<CacheNode<K, V>>>,
}
unsafe impl<K, V> Send for LruCache<K, V> {}
impl<K: std::cmp::Eq + std::hash::Hash + Copy, V> LruCache<K, V> {
/// Create LRU cache instance which holds up to `capacity` nodes at once.
pub fn new(capacity: usize) -> Self {