[common/cache] add a basic lru cache#1600
Conversation
Signed-off-by: Chojan Shang <psiace@outlook.com>
Signed-off-by: Chojan Shang <psiace@outlook.com>
|
Thanks for the contribution! Please review the labels and make any necessary changes. |
|
folly has some interesting LRU cache implementations: |
|
one question about disk based LRU cache, could we assume the size for persistence storage, for example, in sccache, we could set the cache size to 10Gi or more |
Signed-off-by: Chojan Shang <psiace@outlook.com>
At present there are no differences between it and the cache in sccache, except for some differences in dependencies and features. |
Codecov Report
@@ Coverage Diff @@
## master #1600 +/- ##
=======================================
Coverage 71% 72%
=======================================
Files 568 575 +7
Lines 33130 33731 +601
=======================================
+ Hits 23823 24378 +555
- Misses 9307 9353 +46
Continue to review full report at Codecov.
|
|
Tips: |
Signed-off-by: Chojan Shang <psiace@outlook.com>
Signed-off-by: Chojan Shang <psiace@outlook.com>
Signed-off-by: Chojan Shang <psiace@outlook.com>
Signed-off-by: Chojan Shang <psiace@outlook.com>
|
Hello @PsiACE, 🎉 Thank you for opening the pull request! 🎉 |
Signed-off-by: Chojan Shang <psiace@outlook.com>
| } | ||
|
|
||
| /// An LRU cache of files on disk. | ||
| pub type LruDiskCache = DiskCache<LruCache<OsString, u64, DefaultHashBuilder, FileSize>>; |
There was a problem hiding this comment.
We can easily define another disk cache based on a different policy by simply implementing the common_cache::cache::Cache trait.
| use crate::Meter; | ||
|
|
||
| /// A trait for a cache. | ||
| pub trait Cache<K, V, S, M> |
There was a problem hiding this comment.
An almost universal Cache trait
|
CI Passed |
I hereby agree to the terms of the CLA available at: https://datafuse.rs/policies/cla/
Summary
TODO
Changelog
Related Issues
Fixes #1429
Test Plan
Unit Tests
Stateless Tests