Hello,
I would like to know if it is possible to use Apigee Cache to store JSON objects.
The key for the cache is the id:
Example:
{ "items": [ { "id": "413711000", "value1": "aaa", "value2": "bbb" }, { "id": "213219010", "value1": "ccc", "value2": "ddd" }, { "id": "759629010", "value1": "eee", "value2": "ffff" } ] }
Thank you
Solved! Go to Solution.
Dear @nsghir ,
Great Question & Interesting use case,
Yes, It's definitely possible & quick to implement same in Apigee Edge. It's tricky to create individual cache entries in Apigee Edge for each id. Find out why below,
A simple way to solve above query is, Store the entire response as cache in Apigee & filter results on a get call using the Extract Variable Policy & Javascript Policy. Take a look at below video that explains how above problem is solved using different policies in Apigee Edge. Attached different proxies used in the video below for your reference.
Mock Target - jsonkeys-rev1-2016-10-01.zip
Populate Cache - populatecache-rev2-2016-10-01.zip
Get Json Response By Key - getvaluesbykey-rev1-2016-10-01.zip
Additionally, You can enable response cache on above proxy to cache individual items in Apigee cache so that you don't need to retrieve full payload & parse JSON response every time. I missed this in above video, but you can quickly implement same. Hope it helps. Keep us posted if any.