Cache KOReader document hash

This commit is contained in:
jpirnay
2026-02-25 20:14:21 +01:00
parent 1ad1c2a0af
commit b3aae93f41
2 changed files with 87 additions and 0 deletions
+11
View File
@@ -42,4 +42,15 @@ class KOReaderDocumentId {
// Calculate offset for index i: 1024 << (2*i)
static size_t getOffset(int i);
// Hash cache helpers
// Returns the path to the per-book cache file that stores the precomputed hash.
// Uses the same directory convention as the Epub cache (/.crosspoint/epub_<hash>/).
static std::string getCacheFilePath(const std::string& filePath);
// Returns the cached hash if the file size matches, or empty string on miss/invalidation.
static std::string loadCachedHash(const std::string& cacheFilePath, size_t fileSize);
// Persists the computed hash alongside the file size used to compute it.
static void saveCachedHash(const std::string& cacheFilePath, size_t fileSize, const std::string& hash);
};