After updating a value in key value map via UI, older value is retrieved by KeyValueMapOperations/Get

Can anybody explain to me how or why this is happening?

i have updated a kvm value using the Admin UI . Now i want to retrieve the value in my proxy using a KeyValueMapOperations policy with the Get element. But this policy is retrieving the previous value.

I have changed the value from 100 to 60.

Can somebody explain ?

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<KeyValueMapOperations mapIdentifier="NewkeyvalueMap" async="false" continueOnError="false" enabled="true" name="GetKVM">
    <DisplayName>GetKVM</DisplayName>
    <Scope>environment</Scope>
    <Get assignTo="foo_variable">
        <Key>
            <Parameter>k3</Parameter>
        </Key>
    </Get>
</KeyValueMapOperations>
Solved Solved
0 3 329
1 ACCEPTED SOLUTION

KVM cache value will not reflect immediately after you change the value from UI. It takes some time to update the KVM cache.

View solution in original post

3 REPLIES 3

KVM cache value will not reflect immediately after you change the value from UI. It takes some time to update the KVM cache.

It is not updating to the new value.Fluctuating..I had to delete the old key value map..

Correct. In more detail.

The doc states that the default cache is 300 seconds.

It's not that you need to remove the old KVM map. You need to wait til the cache expires.

You can ALTERNATIVELY remove the KVM Map, and use a different map; that would also avoid the cached value.

If you don't want to wait for cache expiry, another way to quickly invalidate the cache is to execute a KeyValueMapOperations / Put with a ExpiryTimeInSecs of 1. That will refresh the cache , with a TTL of 1 second. So the cache will be cleared "quickly".

<KeyValueMapOperations name='KVM-Put-Clear' mapIdentifier='NewkeyvalueMap'>
  <Scope>environment</Scope>
  <Put override='true'>
    <Key>
      <Parameter>k3</Parameter>
    </Key>
    <Value>60</Value>
  </Put>
  <ExpiryTimeInSecs>1</ExpiryTimeInSecs>
</KeyValueMapOperations>

more detail here: https://community.apigee.com/answers/36753/view.html

and here: https://community.apigee.com/comments/71301/view.html