feat: refresh in libraries and books lists

This commit is contained in:
Julien Froidefond
2025-02-22 15:36:32 +01:00
parent b208a2aaf6
commit 448cdf6450
7 changed files with 135 additions and 8 deletions

View File

@@ -283,6 +283,24 @@ class ServerCacheService {
}
}
/**
* Supprime toutes les entrées du cache qui commencent par un préfixe
*/
deleteAll(prefix: string): void {
if (this.config.mode === "memory") {
this.memoryCache.forEach((value, key) => {
if (key.startsWith(prefix)) {
this.memoryCache.delete(key);
}
});
} else {
const cacheDir = path.join(this.cacheDir, prefix);
if (fs.existsSync(cacheDir)) {
fs.rmdirSync(cacheDir, { recursive: true });
}
}
}
/**
* Vide le cache
*/