-
Notifications
You must be signed in to change notification settings - Fork 43
CacheConfig
Thiago da Rosa de Bustamante edited this page Feb 6, 2018
·
6 revisions
Configure cache for API requests.
The Caching system supports two kinds of cache (and both can be used together or alone):
- Browser cache: The gateway can handle HTTP response headers to make the client browsers keep a cache for configured resources.
- Memory Cache: The gateway save copies of the proxied API responses into the Redis database.
The Cache configuration object must be included in the API config and supports the following properties:
Property | Type | Description | Required |
---|---|---|---|
client | ClientCacheConfig | Configuration for a client side cache (in browser). | false |
server | ServerCacheConfig | Configuration for a server side cache (in a Redis store). | false |
Configure HTTP response headers to make the client browsers keeping a cache for configured resources.
It support the following properties:
Property | Type | Description | Required |
---|---|---|---|
cacheTime | string or number | The time to keep the cached resources. You can inform the amount of milisencods, or use a human-interval string. | true |
cacheControl |
'public' , 'private' , 'no-cache' or 'no-store'
|
Configure the HTTP Cache-Control header. |
false |
mustRevalidate | boolean | Configure the HTTP Cache-Control header. |
false |
noTransform | boolean | Configure the HTTP Cache-Control header. |
false |
proxyRevalidate | boolean | Configure the HTTP Cache-Control header. |
false |
Example:
{
"cache": {
"client": {
"cacheTime": "1 minute",
"cacheControl": "public",
"mustRevalidate": false,
"noTransform": false,
"proxyRevalidate": false
}
}
}
Configure the caching system to save copies of the proxied API responses into the Redis database.
It support the following properties:
Property | Type | Description | Required |
---|---|---|---|
cacheTime | string or number | The time to keep the cached resources. You can inform the amount of milisencods, or use a human-interval string. | true |
preserveHeaders | string[] | A list of response received headers that also need to be saved by cache system, to reproduce them to clients. | false |
disableStats | boolean | If true, disable the statistical data recording for cache events. | false |
statsConfig | StatsConfig | Configurations for the cache stats. | false |
Example:
{
"cache": {
"client": {
"cacheTime": "1 minute",
"cacheControl": "public",
},
"server": {
"cacheTime": "10 minutes",
"binary": true,
"preserveHeaders" :["access-control-allow-credentials"]
}
}
}