Skip to content

Commit

Permalink
Implement cache eviction
Browse files Browse the repository at this point in the history
Introduce a `CacheLimit` argument for the `DiskDataCache` to configure the eviction policy. If a limit is set, the cache will track usage of the stored blocks. On put, it will check if the limit has been exceeded and start removing the least recently used blocks if required.

Signed-off-by: Alessandro Passaro <alexpax@amazon.co.uk>
  • Loading branch information
passaro committed Nov 16, 2023
1 parent 68e36c9 commit 2e7bdba
Show file tree
Hide file tree
Showing 5 changed files with 382 additions and 87 deletions.
18 changes: 18 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions mountpoint-s3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ serde = { version = "1.0.190", features = ["derive"] }
bincode = "1.3.3"
sha2 = "0.10.6"
hex = "0.4.3"
linked-hash-map = "0.5.6"
fs2 = "0.4.3"

[target.'cfg(target_os = "linux")'.dependencies]
procfs = { version = "0.15.1", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion mountpoint-s3/src/data_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use mountpoint_s3_client::types::ETag;
use thiserror::Error;

pub use crate::checksums::ChecksummedBytes;
pub use crate::data_cache::disk_data_cache::DiskDataCache;
pub use crate::data_cache::disk_data_cache::{CacheLimit, DiskDataCache};
pub use crate::data_cache::in_memory_data_cache::InMemoryDataCache;

/// Struct representing a key for accessing an entry in a [DataCache].
Expand Down
Loading

0 comments on commit 2e7bdba

Please sign in to comment.