mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-30 18:48:55 +01:00
26 lines
640 B
JavaScript
26 lines
640 B
JavaScript
|
const Logger = require('../Logger')
|
||
|
|
||
|
class CacheController {
|
||
|
constructor() { }
|
||
|
|
||
|
// POST: api/cache/purge
|
||
|
async purgeCache(req, res) {
|
||
|
if (!req.user.isAdminOrUp) {
|
||
|
return res.sendStatus(403)
|
||
|
}
|
||
|
Logger.info(`[MiscController] Purging all cache`)
|
||
|
await this.cacheManager.purgeAll()
|
||
|
res.sendStatus(200)
|
||
|
}
|
||
|
|
||
|
// POST: api/cache/items/purge
|
||
|
async purgeItemsCache(req, res) {
|
||
|
if (!req.user.isAdminOrUp) {
|
||
|
return res.sendStatus(403)
|
||
|
}
|
||
|
Logger.info(`[MiscController] Purging items cache`)
|
||
|
await this.cacheManager.purgeItems()
|
||
|
res.sendStatus(200)
|
||
|
}
|
||
|
}
|
||
|
module.exports = new CacheController()
|