apigee

APIGEE: ExpiryTimeInSecs in KeyValueMapOperations Policy


I need to put some values in the KVM that I made in APIGEEx. As we can't put the key value pairs directly in APIGEEx, we need to use KeyValueMapOperation policy. Now while setting this value in a policy there is property called ExpiryTimeInSecs which takes some value in secs.

I just need to understand what does that exactly do. Let's say that I have specified 'x' secs in ExpiryTimeInSec property, does it mean that the value will be removed from the KVM after the x seconds specified or does it only refreshes the key value after that amount of time? One more thing does that key ever expires or removed from the KVM?

I have gone through the official documentation of APIGEEx for this particular policy and also searched around google about it but couldn't found anything solid there.

I am expecting to understand this policy in its entirety.


Solution

  • KVM is a persistent datastore. The values stored in the KVM will not be removed unless your policy is configured to do so. The values read from KVM are cached internally during runtime in order to help improve the performance. The ExpiryTimeInSecs refers to the time after which the cache is cleared.

    Please take a look at the documentation. This is explained very well.

    Quoting from the docs -

    <ExpiryTimeInSecs> element Specifies the duration in seconds after which Apigee refreshes its cached value from the specified KVM.

    A KVM is a long-term persistence mechanism that stores keys and values in a NoSQL database. Because of this, reading from a KVM at runtime can potentially slow proxy performance. To improve performance, Apigee has a built-in mechanism for caching KVM keys/values in memory during runtime. This KVM Operations policy always reads from cache for GET operations.

    There's also an example explaining how the expiry time works with respect to read and update operations. This should help provide a clear understanding.