further simplify download cache by using a single file

this slightly improves lookup time for each cached entry (etag and last-modified)
by setting both entries next to each other, meaning when the one is found, the other
is already loaded in memory.
This commit is contained in:
ITotalJustice
2024-12-30 21:12:29 +00:00
parent cb7fb0e506
commit 4855a01f1a
3 changed files with 140 additions and 173 deletions

View File

@@ -15,9 +15,7 @@ enum {
// requests to download send etag in the header.
// the received etag is then saved on success.
// this api is only available on downloading to file.
Flag_CacheEtag = 1 << 0,
Flag_CacheLmt = 1 << 1,
Flag_Cache = Flag_CacheEtag | Flag_CacheLmt,
Flag_Cache = 1 << 0,
};
enum class Priority {
@@ -193,18 +191,4 @@ private:
}
};
namespace cache {
bool init();
void exit();
auto etag_get(const fs::FsPath& path) -> std::string;
void etag_set(const fs::FsPath& path, const std::string& value);
void etag_set(const fs::FsPath& path, const Header& value);
auto lmt_get(const fs::FsPath& path) -> std::string;
void lmt_set(const fs::FsPath& path, const std::string& value);
void lmt_set(const fs::FsPath& path, const Header& value);
} // namespace cache
} // namespace sphaira::curl