11ty/eleventy-fetch

Should `dryRun` skip reading from cache?

Zegnat opened this issue · 1 comments

Zegnat commented

This caught me off guard. I was using dryRun to test some requests, and at some point I noticed that they were coming back with answers suspiciously quick. Turned out I had run the request without dryRun at some point and therefor a cached item had become available.

I am not sure what is the more expected behaviour here. When someone sets dryRun to true to disable writing new caches, should it still read old caches anyway?

I do think the effect of dryRun can be made a little more clear in the documentation regardless. I might file a PR for that later, just wanted to get a discussion started here.

dryRun does allow reads from cache, important for running in serverless bundles allowing folks to pre-warm the cache. See #28 (shipped with v4.0.0). You can opt-out of this by setting a cache duration of 0. Happy to review a PR to improve the docs!