audiobookshelf/server/controllers/CacheController.js
2023-07-14 15:04:27 -05:00

24 lines
530 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)
}
await this.cacheManager.purgeAll()
res.sendStatus(200)
}
// POST: api/cache/items/purge
async purgeItemsCache(req, res) {
if (!req.user.isAdminOrUp) {
return res.sendStatus(403)
}
await this.cacheManager.purgeItems()
res.sendStatus(200)
}
}
module.exports = new CacheController()