Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9b88184

Browse files
committed
Make varnish cache purge tasks purge draft caches
modify these tasks to purge the draft caches as well as the live ones. I couldn't think of a scenario in which it would be important to only purge one set of caches and not the other, so I've just made it default to purging both live and draft.
1 parent f836a1f commit 9b88184

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cache.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
from fabric.api import *
22

33
@task
4-
@roles('class-cache')
4+
@roles('class-cache', 'class-draft_cache')
55
def purge(*args):
66
"Purge items from varnish, eg \"/one,/two,/three\""
77
for path in args:
88
run("curl -s -I -X PURGE http://localhost:7999%s | grep '200 Purged'" % path.strip())
99

1010
@task
11-
@roles('class-cache')
11+
@roles('class-cache', 'class-draft_cache')
1212
def restart():
1313
"""
1414
Restart Varnish caches
1515
"""
1616
sudo('/etc/init.d/varnish restart')
1717

1818
@task(default=True)
19-
@roles('class-cache')
19+
@roles('class-cache', 'class-draft_cache')
2020
def stats():
2121
"Show details about varnish performance"
2222
sudo('varnishstat -1')

0 commit comments

Comments
 (0)