<p>Varnish is sometimes used to paint over poorly written code.  It's not horrible to get it up and running, but it seems to me that in this case, it might just be easier to fix the poorly written code.</p>

<p>I believe that what cache warmer does is it pings all of the URLs to get the caches to regenerate... but that just triggers the cache rebuilding process, which isn't instantaneous with Craft CMS.  Did you try waiting a little bit?</p>

<p>Does the data in the large structure change that often?  Something else you could consider too is putting the left menu in a its own template that you cache and load via AJAX so that the rest of the page isn't waiting for it.</p>

CC BY-SA 3.0
2015-11-23T23:40:15.653Z
Thanks @khalwat. No, I didn't wait too long for the cache building process, probably only a few minutes - I thought it might be happening in the background. You other comments make sense so I will progress things in that direction.
Jack McKenzie
CC BY-SA 3.0
2015-11-25T15:59:26.563Z
If your menu doesn't change across pages, {%cache globally %} is a good option, otherwise each url has to grab that menu.
RitterKnight
CC BY-SA 3.0
2015-11-23T23:12:50.043Z
2015-11-23T23:12:50.043Z
andrew.welch
<p>I have a site with some poorly written code which creates the desired left hand menu from a structure with several hundred entries. Page generation on the server for uncached requests takes 3-5 seconds. Longer term I know I need to fix the code, but short term I have cached the section of code using <code>{% cache %}</code> and this works really well - until the cache is cleared.</p>

<p>Now I have tried Cache Warmer and on running the script I get the presumable success message "All urls are all warmed up". However all caches are clearly not warmed up when I test the pages - the first load is still slow (and it isn't local caching that helps). There are some numbers in the Cache Warmer plugin configuration screen that suggest there may be a maximum. Furthermore I have certain pages that are not based on their own entries e.g. A site map which runs straight off its own template. This page is particularly slow until it has been run once. So I am not entirely sure how Cache Warmer works and what I need to do to ensure that it warms the entire cache.</p>

<p>I am not using anything else. Varnish seems like a solution but for me its implementation might be a bit too complex (I don't have full server access and I am not very skilled on the server end).</p>

<cache>
How to best warm the cache
# How to best warm the cache

(Asked by: username_0 on 2015-11-23)

I have a site with some poorly written code which creates the desired left hand menu from a structure with several hundred entries. Page generation on the server for uncached requests takes 3-5 seconds. Longer term I know I need to fix the code, but short term I have cached the section of code using `{% cache %}` and this works really well - until the cache is cleared.

Now I have tried Cache Warmer and on running the script I get the presumable success message "All urls are all warmed up". However all caches are clearly not warmed up when I test the pages - the first load is still slow (and it isn't local caching that helps). There are some numbers in the Cache Warmer plugin configuration screen that suggest there may be a maximum. Furthermore I have certain pages that are not based on their own entries e.g. A site map which runs straight off its own template. This page is particularly slow until it has been run once. So I am not entirely sure how Cache Warmer works and what I need to do to ensure that it warms the entire cache.

I am not using anything else. Varnish seems like a solution but for me its implementation might be a bit too complex (I don't have full server access and I am not very skilled on the server end).

**Tags:** cache


---

## 1 answers

### Answer by username_1 on 2015-11-23. Score: 2

Varnish is sometimes used to paint over poorly written code. It's not horrible to get it up and running, but it seems to me that in this case, it might just be easier to fix the poorly written code.

I believe that what cache warmer does is it pings all of the URLs to get the caches to regenerate... but that just triggers the cache rebuilding process, which isn't instantaneous with Craft CMS. Did you try waiting a little bit?

Does the data in the large structure change that often? Something else you could consider too is putting the left menu in a its own template that you cache and load via AJAX so that the rest of the page isn't waiting for it.

> **Comments:**
> **username_0**: Thanks @khalwat. No, I didn't wait too long for the cache building process, probably only a few minutes - I thought it might be happening in the background. You other comments make sense so I will progress things in that direction.  
> **username_2**: If your menu doesn't change across pages, {%cache globally %} is a good option, otherwise each url has to grab that menu.  

---

