Um exemplo simples, como limpar o cache de verniz com capistrano 3.
namespace :varnish do
set :varnish_auth, "/etc/varnish/secret"
set :varnish_address, "127.0.0.1:6082"
set :varnishadm, "/usr/bin/varnishadm"
desc 'Flush entire cache'
task :flush_all do
on roles(:web) do
execute "#{fetch(:varnishadm)} -T #{fetch(:varnish_address)} -S #{fetch(:varnish_auth)} ban "req.url ~ ^/""""
end
end
desc 'Flush assets cache'
task :flush_assets do
on roles(:web) do
execute ""#{fetch(:varnishadm)} -T #{fetch(:varnish_address)} -S #{fetch(:varnish_auth)} ban ""req.url ~ ^/assets/""""
end
end
end
“