0

I've made my first project app with Django Framework. Now I'm trying to use local memory based caching since I'm just testing its functionality and latency. As most part of my site contains dynamic web pages with different contents for different users, I'm trying to bring in efficiency using template fragment caching. I'm enclosing all the static part of templates of my pages in {% cache %} and leaving dynamically generated part outside using many cache blocks.

I don't seem to understand if it's really going to help my pages to be rendered fast because the part going to be cached is already static. When template engine compiles and executes a template to give response, its running time is directly proportional to number of jinja statements. Right? So if I'm avoiding static part being gone through by template engine, by caching, I'm still leaving most of statements for engine, is it going to help with speed or waste efforts?

P.S. Excuse me for poor framing of question. Really bad at it

  • Best option is to benchmark your site with and without caching so that you know for sure. Lots of mistakes and wasted work can come from making assumptions about your optimizations. I might also suggest profiling your site before adding in optimizations so you know where to spend your time. – saquintes Aug 02 '21 at 16:13
  • Even with performance factor kept aside, it may have an answer to if such caching adds something by comprehension of how template engine works and is affected by fragments caching. – Rihan Sa Aug 02 '21 at 16:52

0 Answers0