How to implement custom cache logic?

Is there any way to implement stale-while-revalidate cache on Tyk? I want to always return cached response even if TTL is over and if TTL is over, then asynchronously revalidate cache on API gateway layer.

Is there any way to request data from cache using JS, Lua or Python? And how to set data into cache programmatically?

I’m investigating Tyk features using local dev install via docker.

Probably worth talking to one of the Tyk engineers. Drop an introductory email to info@ Tyk.io and they’ll be able to discuss your plans and advise accordingly.

James

Hi guys, this page is relevant in Google search results and seems like this scenarios is very common.

@smolnikov how did you solve this problem?

Hello @wedneyyuri and @smolnikov,

Few ways to achieve this,

  1. There are built in caches that you can setup for each API. Take a look here for more info.
  2. You can set and retrieve data in the (Redis) cache programatically using Custom Plugins.