Apigee Environment Cache returns old data after refresh

Hi,

I am facing intermittent old cache value returned even after refreshing the cache with new value.

I am using an environment cache to store user's entitlement details in environment cache. So when entitlement update happens, I refresh the cache via web hook strategy from 3rd party application.

I have set cache entry expiration of 24 hours anyway; but in real time I can't wait or ask the customer to wait for 24 hours to reflect new entitlements.

I am using Populate Cache policy for cache entry insert and update.

I have come through below doc and statement.

------------------------

http://docs.apigee.com/api-services/content/cache-internals

hope this clarifies the doubt:

  • When a policy updates or invalidates an existing cache entry (InvalidateCache, PopulateCache, or ResponseCache policy):
    1. The message processor receiving the request sends a broadcast to update or delete the entry in L1 cache on itself and all other message processors in all regions.
      • If the broadcast succeeds, each receiving message processor updates or removes the entry in L1 cache.
      • If the broadcast fails, the invalidated cache value remains in L1 cache on the message processors that didn't receive the broadcast. Those message processors will have stale data in L1 cache until the entry's time-to-live expires or is removed when message processor memory limits are reached.
    2. The broadcast also updates or deletes the entry in L2 cache.

---------------------------

I feel above docs didn't speak about what step to be taken if broadcast fails or how to avoid broadcast failure in application code itself or with support team.

Any idea or workaround to overcome this...

Restarting MPs will not work out for my use case.

0 2 199
2 REPLIES 2

There are two options that I see

  1. "close the loop". When updating or invalidating the cache, include a some logic to verify that the cache has been invalidated. You may need to iterate to verify that the cache has been invalidated in all ofo the MPs. Unfortunately there is no way to inquire with Apigee whether the broadcast has failed or timedout.
  2. Narrow the window. Keep the cache TTL to a much smaller number, so that if the data is invalid, the exposure is limited to a shorter time. Eg, 10 minutes instead of 24 hours.

You could combine both of these strategies.

Hi Dino, thanks for the reply.
#1 would work out for us. I can include logic to verify the invalidate done or not using the *.failed flag. But how to get the MPs list to iterate to verify individual MPs. Our application runs on Apigee Edge cloud platform.