Apigee can not retreive data from Cache

Not applicable

Morning

I have an issue with PopulateCache , LockupCache and Invalidate Cache Policy.

So, I made a simple scenario to show the problem.

When a user hit the /authorize link, I save the proxy.client.ip in a cache using a random value as keyfragment.

I try to retrieve the value of this cache in the redirection call, and I can found it but when I make twice (or more) the same process it raises a fault because it cannot retrieve the value of the cache.

I give the bundle file to make it simple for you.

Cordially

democache-rev1-2018-01-30.zip

0 4 407
4 REPLIES 4

Hi there

Your proxy on validation is using an invalidate cache policy after successfully doing a lookup. With the invalidate cache policy removed from the flow you should be able to call validation multiple times with the same state

Thanks for your reply.
Yes I know that, but why I have this behaviour? isn't Invalidate Cache policy clear the previous cache? So Why it generate an error?

Not sure what you mean with "previous cache", but InvalidateCache will simply clear the cache for the provided cache key. Should be used when specific values in cache have become invalid and next API call needs to fetch "fresh" data from backend.

1. Authorize ... stores value in cache..

2. Validation... Retrieve from cache.

3. Validation.. Retrieve from cache.

If you have the invalidate cache in validation after doing the retrieve it looks like this

1. Authorize ... stores value in cache..

2. Validation... Retrieve from cache. Invalidate (clear) cache

3. Validation.. (Attempt to) Retrieve from cache - cache empty.