Skip to content
varnish-client is a HTTP client of Varnish
Ruby
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
.gitignore
LICENSE
README.md
purge.vcl
varnish-client.gemspec

README.md

varnish-client

varnish-client is a HTTP client of Varnish.

Install

Add the following line to Gemfile.

gem 'varnish-client', :git => 'https://github.com/mono0x/varnish-client.git'

Install the gem.

$ bundle install

Download purge.vcl.

$ sudo wget https://raw.github.com/mono0x/varnish-client/master/purge.vcl

Add the following line to the main VCL file.

include "/path/to/purge.vcl";

Getting started

Here is an example of purge and fetch the cache.

require 'varnish/client'
varnish = Varnish::Client.new('localhost', 6081, 'http://example.com')
# purge
varnish.purge '^/date/2011/'
varnish.purge '.*'
# fetch
varnish.fetch '/index'
varnish.fetch '/mobile', 'User-Agent' => 'iPhone'
Something went wrong with that request. Please try again.