mistval / node-fetch-cache

Node-fetch with built-in response caching.
MIT License
55 stars 9 forks source link

Feature: cache timeout #4

Closed otherguy closed 3 years ago

otherguy commented 3 years ago

Neat!

It would be even better if you could define a cache timeout :) I work around it now by adding a URL parameter, but having it in the module would be nicer.

mistval commented 3 years ago

Hello, I have marked this as a feature request and will keep it in mind.

mistval commented 3 years ago

This is possible now in version 2.0:

const  { fetchBuilder, FileSystemCache } = require('node-fetch-cache');
const fetch = fetchBuilder.withCache(new FileSystemCache({ ttl: 1000 }));

Please see the README for more info :)