How to use the apicache.clear function in apicache

To help you get started, we’ve selected a few apicache examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github digibib / ls.ext / redef / catalinker / server / routes / services.js View on Github external
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) => {
github google / wikiloop-battlefield / server / routes / interaction.js View on Github external
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();
};
github digibib / ls.ext / redef / catalinker / server / routes / services.js View on Github external
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) => {
github AdhityaRamadhanus / inkscraper / app / routes / api.js View on Github external
(req, res, next) => {
    apicache.clear('JobList')
    next()
  },
  apiHandlers.postJob)
github dana-ross / adrian / app / src / server.js View on Github external
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
}
github sensebox / openSenseMap-API / lib / requestUtils.js View on Github external
const clearCache = function clearCache (identifiers) {
  if (Array.isArray(identifiers)) {
    for (const identifier of identifiers) {
      apicache.clear(identifier);
    }
  } else {
    apicache.clear(identifiers);
  }
};
github sensebox / openSenseMap-API / packages / api / lib / helpers / apiUtils.js View on Github external
const clearCache = function clearCache (identifiers) {
  if (Array.isArray(identifiers)) {
    for (const identifier of identifiers) {
      apicache.clear(identifier);
    }
  } else {
    apicache.clear(identifiers);
  }
};
github quran / quran.com-frontend / server / routes.js View on Github external
server.get('/api/cache/clear', function(req, res, next) {
    return res.send(200, apicache.clear());
  });
github sensebox / openSenseMap-API / lib / requestUtils.js View on Github external
const clearCache = function clearCache (identifiers) {
  if (Array.isArray(identifiers)) {
    for (const identifier of identifiers) {
      apicache.clear(identifier);
    }
  } else {
    apicache.clear(identifiers);
  }
};
github pagesource / universal-react / server / middlewares / pageCache.js View on Github external
const bustPageCache = target => {
  if (redisClient) {
    redisClient.flushdb();
  }
  apiCache.clear(target || '');
};

apicache

An ultra-simplified API response caching middleware for Express/Node using plain-english durations.

MIT
Latest version published 3 years ago

Package Health Score

59 / 100
Full package analysis