You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even when I have fresh metadata files only minutes old (my cacheAge is set to 120 minutes), every single registry request to npm_lazy incurs a small roundtrip to the upstream server to check for freshness.
Simulating a network failure to force it to serve the locally cached version would require significantly more logic in my testing environment.
The whole point of a local cache is to avoid network roundtrips. It's latency, not throughput - the amount of data that is cached is under 50 megabytes, which is a fast download. It's the hundreds of roundtrips to fetch metadata that slow it down. There should be an option to operate entirely locally if the metadata is less than cacheAge old, and hit the upstream registry only if it is older (even avoiding the HEAD request to check for modifications). I really don't need to worry about package updates in the last hour. If I did, I wouldn't be using a cache.
The text was updated successfully, but these errors were encountered:
You can get this behavior by modifying the cacheAge in https://github.com/mixu/npm_lazy/blob/master/config.js. The default is zero (meaning it will request metadata updates every time), despite documentation in the README that says the default is an hour.
For information, the unit of cacheAge is millisecond.
So if you want to set the cache age to avoid registry request for the next 120 minutes, you need to set cacheAge: 7200000 or cacheAge: 120 * 60 * 1000
Even when I have fresh metadata files only minutes old (my cacheAge is set to 120 minutes), every single registry request to npm_lazy incurs a small roundtrip to the upstream server to check for freshness.
Simulating a network failure to force it to serve the locally cached version would require significantly more logic in my testing environment.
The whole point of a local cache is to avoid network roundtrips. It's latency, not throughput - the amount of data that is cached is under 50 megabytes, which is a fast download. It's the hundreds of roundtrips to fetch metadata that slow it down. There should be an option to operate entirely locally if the metadata is less than cacheAge old, and hit the upstream registry only if it is older (even avoiding the HEAD request to check for modifications). I really don't need to worry about package updates in the last hour. If I did, I wouldn't be using a cache.
The text was updated successfully, but these errors were encountered: