1
0
mirror of https://github.com/advplyr/audiobookshelf.git synced 2025-04-02 01:16:54 +02:00
audiobookshelf/server/controllers/CacheController.js
2024-08-10 17:15:21 -05:00

25 lines
547 B
JavaScript

const CacheManager = require('../managers/CacheManager')
class CacheController {
constructor() {}
// POST: api/cache/purge
async purgeCache(req, res) {
if (!req.userNew.isAdminOrUp) {
return res.sendStatus(403)
}
await CacheManager.purgeAll()
res.sendStatus(200)
}
// POST: api/cache/items/purge
async purgeItemsCache(req, res) {
if (!req.userNew.isAdminOrUp) {
return res.sendStatus(403)
}
await CacheManager.purgeItems()
res.sendStatus(200)
}
}
module.exports = new CacheController()