mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Forgot to change the structure of extra_files_cache to allow easy eviction by book_id
This commit is contained in:
parent
9e5bb7a5ea
commit
bd483ab92c
@ -3108,8 +3108,7 @@ class Cache:
|
|||||||
where relpath is the relative path of the file to the book directory using / as a separator.
|
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.
|
stat_result is the result of calling os.stat() on the file.
|
||||||
'''
|
'''
|
||||||
key = book_id, pattern
|
ans = self.extra_files_cache.setdefault(book_id, {}).get(pattern)
|
||||||
ans = self.extra_files_cache.get(key)
|
|
||||||
if ans is None or not use_cache:
|
if ans is None or not use_cache:
|
||||||
ans = []
|
ans = []
|
||||||
path = self._field_for('path', book_id)
|
path = self._field_for('path', book_id)
|
||||||
@ -3118,7 +3117,7 @@ class Cache:
|
|||||||
book_id, path, self.fields['formats'], yield_paths=True, pattern=pattern
|
book_id, path, self.fields['formats'], yield_paths=True, pattern=pattern
|
||||||
):
|
):
|
||||||
ans.append((relpath, file_path, stat_result))
|
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
|
return ans
|
||||||
|
|
||||||
@read_api
|
@read_api
|
||||||
|
Loading…
x
Reference in New Issue
Block a user