Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How to remove a cache using Node.Js

Hi,

I have implemented a custom caching where we are looking up and populating the cache.

Below is the code.

<LookupCache name="Cache.lookupCacheKey"> 
  <DisplayName>Cache.lookupCacheKey</DisplayName> 
  <CacheKey> 
    <Prefix/> 
    <KeyFragment ref="cacheKey"/> 
  </CacheKey> 
  <CacheResource>abc</CacheResource> 
  <Scope>Global</Scope> 
  <AssignTo>cachingInfo</AssignTo> 
</LookupCache>

When I am trying to remove this using node js it is still fetching me the response from cache.

var http = require('http');
var apigee = require('apigee-access');
var cache = apigee.getCache('cache', { resource: 'abc', scope: 'global'} );
cache.remove('cacheKey', function(error) { });
console.log('node.js application starting...');
var svr = http.createServer(function(req, resp) { resp.end('Hello, World!'); });
svr.listen(9000, function() { console.log('Node HTTP server is listening'); });

Am I missing anything?

Thanks in Advance.

0 2 5,922
2 REPLIES 2