requestify icon indicating copy to clipboard operation
requestify copied to clipboard

Make cache expiration responsive to HTTP headers

Open bchelli opened this issue 9 years ago • 2 comments

Hey @ranm8,

First of all, this is amazing what you did with requestify. Thank you!

So I have an issue regarding the caching mechanism. From what I understand the cache has an expiration defined by the request using the options.cache.expires. What I'm trying to do is to allow the API to set the expiration for the cache using the standard HTTP cache control headers:

  • Cache-Control
  • Expires

In order to do that, I have created a custom cache transporter which is parsing the response headers and:

  • sets the cache if allowed by the API
  • gets the cache if not expired

The problem is this is always overloaded by the global expiration mechanism of requestify. https://github.com/ranm8/requestify/blob/master/lib/requestify.js#L160

Finally! The actual question: Could we let the cache transporter handle the expiration of the cache and pass to it the cache config?

Btw, if you want I can create a pull request with my cache transporter.

Thanks,

bchelli avatar Sep 06 '16 21:09 bchelli

Bump

serkolch avatar Feb 03 '17 21:02 serkolch

@ranm8, any update?

bchelli avatar Feb 06 '17 18:02 bchelli