caching - What's the best way to prime/refresh a url in varnish 4 using a single http request? -


the force cache miss note states:

forcing cache misses not evict old content. means causes varnish have multiple copies of content in cache. in such cases, newest copy used. keep in mind duplicated objects stay long time-to-live positive.

i don't want keep multiple copies in cache. approach of priming url valid? manually evict old content adding them ban lurker. , forcing cache miss myself replace content banned.

acl purge_prime {     "127.0.0.1";     "::1"; }  sub vcl_recv {     if (req.method == "prime") {         if (!client.ip ~ purge_prime) {             return(synth(405,"no priming you. (" + client.ip + ")"));         }         # add ban lurker. purging existing pages.         ban("obj.http.x-host == " + req.http.host + " && obj.http.x-url == " + req.url);         # call backend fetch new content , add cache.         set req.method = "get";         set req.hash_always_miss = true;     }     # ... other custom rules. }  # ... other subroutines below, e.g. adding ban-lurker support etc. 

the logic makes sense me, i'm worried because no-one else has done (which i'm assuming there's reason for).

is wrong approach on using purge restart, if what's best way prime url using single http request?

i suppose approach not because uses bans. using purges opposed bans allow leverage grace mode.

restarts fine - not result in 2 or more http requests, rather push request through vcl state machine once again.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -