Layer7 API Management

  • 1.  Gateway Policy: Remove from Cache?

    Posted Nov 12, 2015 08:41 AM

    Hi,

     

    I have a simple and straightforward question that I can't seem to find an answer for elsewhere.

     

    In our policies we use caching assertions (Store to Cache/Look Up in Cache) for reading and storing data in the gateway cache.

    Sometimes we need to invalidate items in the cache.

     

    How can I remove an item from the cache based on a cache key?

     

    BR,

    Tony



  • 2.  Re: Gateway Policy: Remove from Cache?

    Posted Nov 12, 2015 08:58 AM

    If the TTL does not deal with your removal, to "remove" you just do another "put" into the cache with a STATIC value like "INVALID". You can then check that value if you get another cache hit.



  • 3.  Re: Gateway Policy: Remove from Cache?

    Posted Nov 12, 2015 09:19 AM

    Nice Idea!, never thought of this....

     

    i do agree that this feature should be added, feel free to create an Idea for it and don't forget to vote on it yourself. Andy's suggestion is a nice workaround.

     

    There is a way to invalidate All cache, if this is helpful. Just increment the number in the messageCache.resetGeneration cluster wide property. This will invalidate all local cache on the gateway.

     

    cache.png



  • 4.  Re: Gateway Policy: Remove from Cache?

    Posted Nov 16, 2015 12:08 PM

    Updating the cache entry and setting the Maximum Entry Age to "0" should remove it.  I think this is what Andy was suggesting with the TTL.