Document updated on May 2, 2021
Since | v0.4 |
---|---|
Namespace | github.com/devopsfaith/krakend-httpcache |
Scope | backend |
Source | krakend/krakend-httpcache |
Sometimes you might want to reuse a previous response of a backend instead of asking for the same information over the network again. In this cases, it is possible to enable in-memory caching for the desired backend responses.
This caching technique applies to traffic between KrakenD and your microservices endpoints only and is not a caching system for the end-user endpoints. To enable the cache, you only need to add in the configuration file the httpcache
middleware.
When enabled all connections for the configured backend are cached in-memory for the amount of time retrieved from the Cache-Control
header of the response.
If you enable this module, you are required to be very aware of the response sizes, caching times and the hit-rate of the calls.
Enable the caching of the backend services in the backend
section of your krakend.json
with the middleware:
"github.com/devopsfaith/krakend-httpcache": {}
The middleware does not require additional configuration other than the simple inclusion.
See an example:
...
"backend": [
{
"url_pattern": "/",
"host": ["http://my-service.tld"],
"extra_config": {
"github.com/devopsfaith/krakend-httpcache": {}
}
}
]
…
The documentation is only a piece of the help you can get! Whether you are looking for Open Source or Enterprise support, see more support channels that can help you.
We use cookies to understand how you use our site and to improve your overall experience. By continuing to use our site, you accept our Privacy Policy. More information