-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DiskCache blobs aren't cleaned on overwrite #206
Comments
Update: |
Running this test multiple times seems to reproduce the problem of accumulating files in the blobs folder of the cache: #[io_cached(
disk = true,
time = 1000000,
map_error = r##"|e| TestError::DiskError(format!("{:?}", e))"##,
key = "u32",
convert = r"{ n }",
)]
async fn cached_disk(n: u32) -> Result<Vec<u32>, TestError> {
Ok((0..n).collect::<Vec<_>>())
}
#[tokio::test]
async fn test_cached_disk() {
let n = 1_000_000;
let expected = Ok((0..n).collect::<Vec<_>>());
assert_eq!(cached_disk(n).await, expected);
assert_eq!(cached_disk(n).await, expected);
} |
Unfortunately, this issue makes |
Thanks for pointing this out. I'm able to reproduce also. It looks like this is due to either a bug or the intended operation of the underlying |
There is a potential ugly workaround until the storage backend is swapped. |
Thanks for prompt reply. It seems to me that
I thought about something similar myself, but it is really an ugly workaround :-) I'll try. |
RocksDB may be a better choice. |
Personally I have switched to sled DB at home and did a combination of Cacache for the storage and serde_rmp to convert to binary data Not sure if it's the best way tho. But once this issue is sorted I'm definitely switching back |
I am using a DiskCache with an inner vector, making files in the blob folder of the cache. However, those blob files aren't removed/overwritten when I'm overwriting a cache entry. This leads to inflated storage usage that I rather not have since those structs are heavy.
Here's a example program to test the bug:
The text was updated successfully, but these errors were encountered: