unjs / nitro

Next Generation Server Toolkit. Create web servers with everything you need and deploy them wherever you prefer.
https://nitro.unjs.io
MIT License
5.89k stars 496 forks source link

Warn when cache computation is cheaper than cache retrival #2559

Open pi0 opened 3 months ago

pi0 commented 3 months ago

(From question by @InstantlyMoist in https://github.com/unjs/nitro/discussions/2558)

In development mode, we can detect situations when cache computation is cheaper than storing and retrieving it to warn users about it. It is not a precise prediction though because in production (when cache might be stored externally to disk or a remote server and database/server load is heavier than single user local/staging, the cache would make sense so maybe if we do it, we should do it for dev and prod)