mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-08 10:21:38 +00:00
perf: avoid stale filter cache rebuilds
This commit is contained in:
parent
80eaccd1e6
commit
be98c79007
3 changed files with 115 additions and 3 deletions
|
|
@ -593,7 +593,6 @@ class Database {
|
|||
return cacheEntry
|
||||
}
|
||||
|
||||
delete this.libraryFilterData[libraryId]
|
||||
return undefined
|
||||
}
|
||||
|
||||
|
|
@ -609,6 +608,15 @@ class Database {
|
|||
return cacheEntry
|
||||
}
|
||||
|
||||
refreshLibraryFilterCache(libraryId, ttlMs = this.libraryFilterDataTtlMs) {
|
||||
const cacheEntry = this.libraryFilterData[libraryId]
|
||||
if (!cacheEntry) return undefined
|
||||
|
||||
cacheEntry.loadedAt = Date.now()
|
||||
cacheEntry.expiresAt = cacheEntry.loadedAt + ttlMs
|
||||
return cacheEntry
|
||||
}
|
||||
|
||||
invalidateLibraryFilterCache(libraryId) {
|
||||
delete this.libraryFilterData[libraryId]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue