mistval / node-fetch-cache

Node-fetch with built-in response caching.
MIT License
51 stars 8 forks source link

Support for http cache (If-Modified-Since, If-None-Match) #23

Closed slavb18 closed 2 years ago

slavb18 commented 2 years ago

Hi!

Any plans to implement http style cache with If-Modified-Since, If-None-Match headers

e.g.

  1. check ttl cache
  2. if cache exists and ttl is NOT expired, return result from cache (currently supported),
  3. if cache exitsts, but ttl is expired, and cached response contains Last-Modified / ETag header, then issue fetch with If-Modified-Since / If-None-Match headers. If server response is 304 Not Modified, then return result from cache
mistval commented 2 years ago

Hi,

Have you looked at make-fetch-happen yet? I think it might be able to do what you need.

I'm personally only interested in using this package to cache everything, so I have no plans to implement more customizable caching, but would not object to PRs.