mirror of https://github.com/msgbyte/tailchat
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
524 B
TypeScript
30 lines
524 B
TypeScript
import { Router } from 'express';
|
|
import { broker } from '../broker';
|
|
import { auth } from '../middleware/auth';
|
|
|
|
const router = Router();
|
|
|
|
/**
|
|
* 清理所有缓存
|
|
*/
|
|
router.post('/clean', auth(), async (req, res, next) => {
|
|
try {
|
|
if (!broker.cacher) {
|
|
res.json({
|
|
success: false,
|
|
message: 'Not found cacher',
|
|
});
|
|
return;
|
|
}
|
|
await broker.cacher.clean();
|
|
|
|
res.json({
|
|
success: true,
|
|
});
|
|
} catch (err) {
|
|
next(err);
|
|
}
|
|
});
|
|
|
|
export { router as cacheRouter };
|