{ Community }
  • Academy
  • Docs
  • Developers
  • Resources
    • Community Articles
    • Apigee on GitHub
    • Code Samples
    • Videos & eBooks
    • Accelerator Methodology
  • Support
  • Ask a Question
  • Spaces
    • Product Announcements
    • General
    • Edge/API Management
    • Developer Portal (Drupal-based)
    • Developer Portal (Integrated)
    • API Design
    • APIM on Istio
    • Extensions
    • Business of APIs
    • Academy/Certification
    • Adapter for Envoy
    • Analytics
    • Events
    • Hybrid
    • Integration (AWS, PCF, Etc.)
    • Microgateway
    • Monetization
    • Private Cloud Deployment
    • 日本語コミュニティ
    • Insights
    • IoT Apigee Link
    • BaaS/Usergrid
    • BaaS Transition/Migration
    • Apigee-127
    • New Customers
    • Topics
    • Questions
    • Articles
    • Ideas
    • Leaderboard
    • Badges
  • Log in
  • Sign up

Get answers, ideas, and support from the Apigee Community

  • Home /
  • Edge/API Management /
avatar image
1
Question by maivizhi · Dec 20, 2016 at 07:24 AM · 2.3k Views kvmexpiry time

How to refresh the KVM cache forcefully

In the KVM configuration, I have setup the cache expiry time as 24 hrs. But, when I changed my KVM value in the middle, the change got reflected in the flow only after 24 hrs (which is not developer friendly)

Is it possible to explicitly invalidate the KVM, and force a cache update?

Comment
Add comment Show 4
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image maivizhi · Dec 29, 2016 at 06:43 AM 0
Link

any suggestions on the above query? appreciate it if a solution is provided as soon as possible

avatar image Nisha Mallesh maivizhi   · Dec 29, 2016 at 06:47 AM 0
Link

@maivizhi

How vulnerable is it? If you are changing KVM values once in a while (during development only), then you may set the expiry time to lesser value during the change and have it readily affected through the development process.

avatar image maivizhi Nisha Mallesh · Dec 29, 2016 at 10:50 AM 0
Link

Thanks @Nisha Mallesh

Please find my detailed analysis on KVM :)

  1. Updated KVM entry in UI
  2. Deleted the KVM entry from UI
  3. Updated the expiry time in KVM policy (24 hrs to 10 secs)

In all three case i could see the below observation

  • When i test it through Management api.I am able to see the updated value(Hope its pulling the data from Datastore)
  • But the same is not reflecting back in KVM policy as the value is being pulled from Cache(in-memory)

When i tried updating the expiry time in KVM to 10 secs and when i tried my request i could still see that the KVM is still pointing to the old value(Hope the cached value will retain the old value forl 24 hrs though the expiry time is updated)

Badly waiting for a solution to flush the cached value and update with new value in KVM cache

Wondering what if we make the KVM expiry time as never expire !

Show more comments

Close

2 Answers

  • Sort: 
avatar image
2

Answer by Vipul Agarwal   · Dec 29, 2016 at 01:34 PM

Hi @maivizhi

Documentation says :Use -1 only when a value will never change, because Edge will never refresh it. If you've already set -1 and you want to refresh based on a new expiration interval, create a new KeyValueMap and reference it in the policy (with the mapIdentifier).

Read More about KVM

I did not find a way to clear the KVM cache. What you can do is create a new KVM and refrer to this KVM in mapIdentifier (as suggested in documentation).

Comment
Add comment Show 3 · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Dino-at-Google ♦♦   · Aug 02, 2019 at 07:04 PM 1
Link

Two things -

If you use 0 or anything less than 0, I believe the behavior now is to use the default TTL, which is 300 seconds. (The doc has been updated).

You can clear the KVM cache as a side effect by writing any value (Put operation) with an ExpiryTImeInSecs of 1.

Eg

<KeyValueMapOperations name='KVM-Put-Clear' mapIdentifier='nameOfMap'>
  <Scope>organization</Scope>
  <Put override='true'>
    <Key>
      <Parameter>p1</Parameter>
    </Key>
    <Value>Something</Value>
  </Put>
  <ExpiryTimeInSecs>1</ExpiryTimeInSecs>
</KeyValueMapOperations>

This has the effect of writing the KVM and loading the written value into the cache with a TTL of 1 second. After 1 second the cache entry will disappear; though the value you've written to the KVM will remain in persistent store.

avatar image Ravindra Singh Dino-at-Google ♦♦ · Aug 04, 2019 at 10:31 AM 0
Link

This is the nice workaround @Dino-at-Google, Thanks for sharing the option.

avatar image Joshua Cariño Dino-at-Google ♦♦ · Dec 07, 2020 at 08:25 AM 0
Link

I almost did this only to realize that the KVM name/ identifier promoted by the one who serviced it is wrong. I didn't realized it as the one that is being shown in my browser turns out to be he old cache of the KVM name, and not the latest KVM name. And when I open that old cache of the KVM, it would show the correct updated keys, but it wont just show the updated KVM name and instead shown me the old KVM name. So I have my browser reset then to be able to see the latest KVM name in the Apigee Edge UI, and finally be able to realize the service guy did something wrong in updating the KVM and not us or our APIs, haha.

avatar image
2

Answer by aagrawal · Jan 18, 2017 at 12:33 AM

Hi @maivizhi,

If you will update the KVM entry using the policy instead of management UI or management API then it will refreshes the cache for you. So a temporary solution that I would suggest is - create an utility API which updates your KVM using the KeyValueMap policy.

Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Follow this Question

Answers Answers and Comments

48 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Copying KVM values from one environment to another 9 Answers

adding a value to kvm 1 Answer

Unreliable KVM return values 1 Answer

KV Settings in Policy Issue 3 Answers

What's the use case of KVM Scope @ Policy level ? 1 Answer

  • Products
    • Edge - APIs
    • Insights - Big Data
    • Plans
  • Developers
    • Overview
    • Documentation
  • Resources
    • Overview
    • Blog
    • Apigee Institute
    • Academy
    • Documentation
  • Company
    • Overview
    • Press
    • Customers
    • Partners
    • Team
    • Events
    • Careers
    • Contact Us
  • Support
    • Support Overview
    • Documentation
    • Status
    • Edge Support Portal
    • Privacy Policy
    • Terms & Conditions
© 2021 Apigee Corp. All rights reserved. - Apigee Community Terms of Use - Powered by AnswerHub
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Spaces
  • Product Announcements
  • General
  • Edge/API Management
  • Developer Portal (Drupal-based)
  • Developer Portal (Integrated)
  • API Design
  • APIM on Istio
  • Extensions
  • Business of APIs
  • Academy/Certification
  • Adapter for Envoy
  • Analytics
  • Events
  • Hybrid
  • Integration (AWS, PCF, Etc.)
  • Microgateway
  • Monetization
  • Private Cloud Deployment
  • 日本語コミュニティ
  • Insights
  • IoT Apigee Link
  • BaaS/Usergrid
  • BaaS Transition/Migration
  • Apigee-127
  • New Customers
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Badges