Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
intercept: (rsp, data, req, res, callback) => {
if ([ 'PUT', 'PATCH', 'DELETE' ].indexOf(rsp.req.method) !== -1) {
apicache.clear(req.originalUrl)
apicache.clear(req.originalUrl + '/references')
apicache.clear(req.originalUrl + '/relations')
console.log(`clearing ${req.originalUrl}`)
}
callback(null, data)
},
decorateRequest: (proxyReq, req) => {
old: revision.parentid,
},
ores: this.ores,
user: revision.user,
wiki: revision.wiki,
timestamp: revision.timestamp
}
}
*/
let doc = req.body;
await mongoose.connection.db.collection(`Interaction`).findOneAndReplace({
userGaId: userGaId,
wikiRevId: wikiRevId,
}, doc, { upsert: true });
apicache.clear(req.originalUrl);
let storedInteractions = await getNewJudgementCounts(mongoose.connection.db, { wikiRevId: { $in: [wikiRevId] } });
let storedInteraction = storedInteractions[0];
storedInteraction.newJudgement = {
userGaId: doc.userGaId,
judgement: doc.judgement,
timestamp: doc.timestamp
};
io.sockets.emit('interaction', storedInteraction);
res.send(`ok`);
req.visitor
.event({ ec: "api", ea: "/interaction" })
.event("judgement", req.body.judgement)
.send();
};
intercept: (rsp, data, req, res, callback) => {
if ([ 'PUT', 'PATCH', 'DELETE' ].indexOf(rsp.req.method) !== -1) {
apicache.clear(req.originalUrl)
apicache.clear(req.originalUrl + '/references')
apicache.clear(req.originalUrl + '/relations')
console.log(`clearing ${req.originalUrl}`)
}
callback(null, data)
},
decorateRequest: (proxyReq, req) => {
(req, res, next) => {
apicache.clear('JobList')
next()
},
apiHandlers.postJob)
const deleteFont = (path, log = true) => {
if(fonts[path]) {
apicache.clear(null)
delete fonts[path]
if(log) { logger.log(`Removed font ${path}`) }
return true
}
return false
}
const clearCache = function clearCache (identifiers) {
if (Array.isArray(identifiers)) {
for (const identifier of identifiers) {
apicache.clear(identifier);
}
} else {
apicache.clear(identifiers);
}
};
const clearCache = function clearCache (identifiers) {
if (Array.isArray(identifiers)) {
for (const identifier of identifiers) {
apicache.clear(identifier);
}
} else {
apicache.clear(identifiers);
}
};
server.get('/api/cache/clear', function(req, res, next) {
return res.send(200, apicache.clear());
});
const clearCache = function clearCache (identifiers) {
if (Array.isArray(identifiers)) {
for (const identifier of identifiers) {
apicache.clear(identifier);
}
} else {
apicache.clear(identifiers);
}
};
const bustPageCache = target => {
if (redisClient) {
redisClient.flushdb();
}
apiCache.clear(target || '');
};