I want to cache pages on my nginx site for fast retrieval. Let's say every 5 hours I want to expire all the cache and have it recreated. Will Varnish make calls to the web-server and recreate cache on it's own or will it have to wait till a user requests a page?
Asked
Active
Viewed 97 times
2 Answers
2
No, Varnish does not generate requests that re-create its caches.
You need to make a manual refresh of the pages in order to get the cache warm.

Tero Kilkanen
- 36,796
- 3
- 41
- 63
1
varnishd - HTTP accelerator daemon
, it's not it's job to handle those kind of things, but what you can do is schedule a cron job
(using curl
, wget
, etc) that would trigger hitting pages that you like and Varnish
will cache them.
curl
:
[alexus@wcmisdlin02 ~]$ curl --help | grep -- '--silent'
-s/--silent Silent mode. Don't output anything
[alexus@wcmisdlin02 ~]$
wget
:
[alexus@wcmisdlin02 ~]$ wget --help | grep -- '--quiet'
-q, --quiet quiet (no output).
[alexus@wcmisdlin02 ~]$

alexus
- 13,112
- 32
- 117
- 174
-
curl or wget? I don't need the results, I just have to "call" the page and have it triggered without transferring content – Jimbotron Aug 27 '14 at 20:24
-
@Jimbotron you can always redirect redirect output to `>/dev/null`) – alexus Aug 27 '14 at 21:19
-
Yes I can do that but it's still a waste of data transfer. Is there no way to call and abandon request? – Jimbotron Aug 28 '14 at 20:51
-
1@Jimbotron it's not a waste as `Varnish` need to preserve a copy of it for next serve it for next user, if something you just doing work on behalf of user, so that user doesn't have to wait for the backend. – alexus Aug 28 '14 at 20:54