Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production view cache #261

Open
pi0neer opened this issue Aug 16, 2019 · 8 comments
Open

Production view cache #261

pi0neer opened this issue Aug 16, 2019 · 8 comments

Comments

@pi0neer
Copy link

pi0neer commented Aug 16, 2019

I'm confused with template caching, i've disabled it with app.disable('view cache');.
In development everything is fine, but in production templates are still cached anyways. How can i disable it?

@UziTech
Copy link

UziTech commented Aug 16, 2019

https://github.com/ericf/express-handlebars#template-caching

Try passing cache: false as an option to the render call

@pi0neer
Copy link
Author

pi0neer commented Aug 20, 2019

It doesn't seem right in my opinion. I just wanna disable it for whole app at once, instead of passing a prop to each render call, also it's really uncomfortable in case of a big app. Documentation even says that is easiest way to control template/view caching and i would like to do it so.

@mortezae
Copy link

Hi there. I have two question regarding cache in production. Ask it here because found the question similar to myself.

  1. I don't want "page caching" (is it that so called "view cache"?), But I don't want templates read from disk by every request.
  2. I want compilation be done just once during app run time If possible. I mean templates to be half ready, to consume less cpu. I don't know whether it's the default behavior (some "implicit precompilation"?).

@UziTech
Copy link

UziTech commented Jun 22, 2024

Yes caching is default behavior

@mortezae
Copy link

Thanks for response. So please, how to avoid page cache while still taking advantage of this default caching behavior?

@UziTech
Copy link

UziTech commented Jun 22, 2024

app.disable('view cache');

@mortezae
Copy link

mortezae commented Jun 22, 2024

Yeah, but then It reads the template from disk for each request. This is a test with inotify:

morteza@pc1:~/accounting$  inotifywait views/home.hbs
Setting up watches.
Watches established.
views/home.hbs OPEN   <-- here we receive a new http request

P.S. Clarification: Readme has already been read and question was regarding production mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants