lib/shellac/cache.rb in shellac-0.0.1 vs lib/shellac/cache.rb in shellac-0.0.2
- old
+ new
@@ -4,25 +4,25 @@
VARNISH_CONFIGURATION = YAML.load_file("#{Rails.root.to_s}/config/varnish.yml")[::Rails.env]
# return client instance
def client
- @client ||= Varnish::Client.new "#{config("host")}:#{config("port")}",
- :timeout => config("timeout"),
- :keep_alive => config("keep_alive")
+ @client ||= Varnish::Client.new "#{config("host")}:#{config("port")}",
+ :timeout => config("timeout"),
+ :keep_alive => config("keep_alive")
end
# purge a regular expression of url
- def purge path, recursive=false
+ def purge path, recursive
if recursive
regex = "^#{path}" # purge any page starting with regex
else
regex = "^#{path}$"
end
# write to log
- Rails.logger.info "Purging#{" (recursively)" if recursive}: #{path}"
+ Rails.logger.info "*** Purging#{" (recursively)" if recursive}: #{path}"
# purge with
client.purge "req.http.host ~ ^#{config("host")} && req.url ~ #{regex}"
end
\ No newline at end of file