Add:Purge items cache button and api endpoint

This commit is contained in:
advplyr 2022-10-02 14:46:48 -05:00
parent 02d997897c
commit 142205f060
5 changed files with 56 additions and 7 deletions

View file

@ -114,6 +114,15 @@ class CacheManager {
await this.ensureCachePaths()
}
async purgeItems() {
if (await fs.pathExists(this.ItemCachePath)) {
await fs.remove(this.ItemCachePath).catch((error) => {
Logger.error(`[CacheManager] Failed to remove items cache dir "${this.ItemCachePath}"`, error)
})
}
await this.ensureCachePaths()
}
async handleAuthorCache(res, author, options = {}) {
const format = options.format || 'webp'
const width = options.width || 400