We often get questions about the caching feature in the Node.js "apigee-access" module and how it interacts with the "LookupCache" and "PopulateCache" policies.
This is a sample that shows how the two sets of functionality can work together. It consists of two API proxy bundles:
edgeproxy.zip: An Apigee Edge proxy that uses the LookupCache and PopulateCache policies to cache items in the Edge cache.
nodeproxy.zip: A Node.js application that uses "apigee-access" to access and modify the same entires in the same cache.
To use, deploy both proxies to your Apigee Edge organization.
(Both of these proxies depend on a "cache resource" called "mycache." They will not deploy unless you create that first. Alternately, you can experiment by removing the cache resource name and all the code will use the default cache resource.)
Once they are deployed:
To put something in the cache:
curl http://XXX.apigee.net/edgecache?key=baz -X PUT -H "Content-Type: text/plain" -d 'SOME DATA"
curl http://XXX.apigee.net/nodecache?key=baz -X PUT -H "Content-Type: text/plain" -d 'SOME DATA"
curl http://XXX.apigee.net/edgecache?key=baz
edgeproxy.zipnodeproxy.zipcurl http://XXX.apigee.net/nodecache?key=baz
Thanks for the sample. Have you tried the same after adding a Prefix? I cannot get my setup working when I use prefix.