question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Caching views for a limited time only

See original GitHub issue

As far as I understand, I can use res.render(fileName, {"cache": true, "data" : data}); to cache a view, right?

However, since data may change on my views regularly, it doesn’t make sense for me to cache the view for a long period of time. However, I guess that caching it for short periods of time could still improve the performance of my application (if I have a lot concurrent request).

Is there any way I could make EJS cache the template/view for say 5 sec. and then render it once an cache it again for 5 seconds?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
mitommcommented, Nov 25, 2016

yup, since I’m already using an NGINX reverse proxy, I guess caching with NGINX is the way to go.

Thanks for the quick help.

0reactions
RyanZimcommented, Nov 25, 2016

@mitomm Does this answer your question? If so, please close.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Guide for Caching and HTTP Cache Headers for Static Content
It reduces the time it takes for the user to view the images or Javascript or CSS ... Only the end user can...
Read more >
What is Caching and How it Works - AWS
In addition, when local caches are used, they only benefit the local application consuming the data. In a distributed caching environment, the data...
Read more >
Everything You Ever Wanted To Know About View Caching In ...
However, loading it up a second time only takes a few milliseconds because everything inside the cache do block is fetched from the...
Read more >
What is Time to Live (TTL) | TTL Best Practices | CDN Guide
Time to live (TTL) is the time that an object is stored in a caching system before it's deleted or refreshed. In the...
Read more >
HTTP caching - MDN Web Docs
Cache busting is a technique to make a response cacheable over a long period by changing the URL when the content changes. The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found