When using Express with NodeJS - How Does View Cache Work? When using Express with NodeJS - How Does View Cache Work? express express

When using Express with NodeJS - How Does View Cache Work?


As you can see it from the source, view cache is enabled by default only on production environment. If you don't need caching on development (or other environments) you can omit setting it explicitly.

How view caching works instead is pretty simple. If enabled, express stores compiled template in process memory and renders the cached version. This way no temporary cache files are generated and the template is retrieved quickly from memory.