diff --git a/prometheus/index.js b/prometheus/index.js index cf7afc2..0c84d9d 100644 --- a/prometheus/index.js +++ b/prometheus/index.js @@ -283,6 +283,11 @@ app.get(Settings.path, async (req, res, next) => { app.get('/check', (_, res) => res.send('OK')); +app.delete('/cache', (_, res) => { + store.clear(); + res.send('Cache cleared!'); +}); + const server = app.listen(env('PORT', 3000), () => { configureTimer(); console.log('Server listening on port %d', server.address().port); diff --git a/prometheus/store.js b/prometheus/store.js index caeab46..2b0f036 100644 --- a/prometheus/store.js +++ b/prometheus/store.js @@ -18,6 +18,11 @@ class Store { get(key) { return this.cache.get(key) || this.data[key]; } + + clear() { + this.data = {}; + this.cache.flush(); + } } module.exports = Store;