Merge pull request #62 from rustic-rs/fix-cache

fix cache
This commit is contained in:
aawsome 2022-07-13 15:01:20 +02:00 committed by GitHub
commit d415ebec00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -67,7 +67,9 @@ impl<BE: WriteBackend> ReadBackend for CachedBackend<BE> {
) -> Result<Vec<u8>> {
match (&self.cache, cacheable || tpe.is_cacheable()) {
(None, _) | (Some(_), false) => {
self.be.read_partial(tpe, id, false, offset, length).await
self.be
.read_partial(tpe, id, cacheable, offset, length)
.await
}
(Some(cache), true) => match cache.read_partial(tpe, id, offset, length).await {
Ok(res) => Ok(res),

View File

@ -56,8 +56,8 @@ impl FileType {
pub fn is_cacheable(&self) -> bool {
match self {
FileType::Config | FileType::Key => false,
FileType::Snapshot | FileType::Index | FileType::Pack => true,
FileType::Config | FileType::Key | FileType::Pack => false,
FileType::Snapshot | FileType::Index => true,
}
}
}