From bd483ab92c7a0245782541ff71095525b6e24e92 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 23 Apr 2023 22:05:33 +0530 Subject: [PATCH] Forgot to change the structure of extra_files_cache to allow easy eviction by book_id --- src/calibre/db/cache.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/calibre/db/cache.py b/src/calibre/db/cache.py index 30a4faaaee..08bce569f0 100644 --- a/src/calibre/db/cache.py +++ b/src/calibre/db/cache.py @@ -3108,8 +3108,7 @@ class Cache: where relpath is the relative path of the file to the book directory using / as a separator. stat_result is the result of calling os.stat() on the file. ''' - key = book_id, pattern - ans = self.extra_files_cache.get(key) + ans = self.extra_files_cache.setdefault(book_id, {}).get(pattern) if ans is None or not use_cache: ans = [] path = self._field_for('path', book_id) @@ -3118,7 +3117,7 @@ class Cache: book_id, path, self.fields['formats'], yield_paths=True, pattern=pattern ): ans.append((relpath, file_path, stat_result)) - self.extra_files_cache[key] = ans = tuple(ans) + self.extra_files_cache[book_id][pattern] = ans = tuple(ans) return ans @read_api