Closed Zyles closed 3 years ago
Hey,
Try this: https://github.com/AlbinoDrought/cachios#custom-response-copier
cachios.getResponseCopy = function (response) {
return {
status: response.status,
headers: response.headers,
data: response.data,
};
};
getResponseCopy
is used when modifying a response before storing it in cache. By default it trims responses down to just status
and data
, which is likely the issue here.
getCacheIdentifier
is used when determining the cache key used for a request. The default implementation looks like this:
function defaultCacheIdentifer(config) {
return {
method: config.method,
url: config.url,
params: config.params,
data: config.data,
};
}
Which generally covers most cases. Your above example will change the cache key and send a new request if method, url, query params, body, or headers do not match a request in cache.
Oh derp. I realized the first function was for the cache key.
Thanks.
Hello again.
I need headers saved in my cache using LRU.
I tried the:
But it did not make a difference and still only saves status and data.
So I was wondering wether LRU cache does not support this?
How can I save headers with LRU cache?
Thanks.