Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
0aac4167
Commit
0aac4167
authored
Feb 26, 2014
by
Per Buer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
4.0 rewrite
parent
56adaeb2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
146 additions
and
86 deletions
+146
-86
vcl-built-in-subs.rst
doc/sphinx/users-guide/vcl-built-in-subs.rst
+146
-86
No files found.
doc/sphinx/users-guide/vcl-built-in-subs.rst
View file @
0aac4167
...
@@ -22,7 +22,7 @@ yourself doing frequently.
...
@@ -22,7 +22,7 @@ yourself doing frequently.
The vcl_recv subroutine may terminate with calling ``return()`` on one
The vcl_recv subroutine may terminate with calling ``return()`` on one
of the following keywords:
of the following keywords:
error
code [reason]
error
Return the specified error code to the client and abandon the request.
Return the specified error code to the client and abandon the request.
pass
pass
...
@@ -31,56 +31,117 @@ of the following keywords:
...
@@ -31,56 +31,117 @@ of the following keywords:
pipe
pipe
Switch to pipe mode. Control will eventually pass to vcl_pipe.
Switch to pipe mode. Control will eventually pass to vcl_pipe.
lookup
hash
Look up the requested object in the cache. Control will
Continue processing the object as a potential candidate for
eventually pass to vcl_hit or vcl_miss, depending on whether the
caching. Passes the control over to vcl_hash.
object is in the cache. The ``bereq.method`` value will be set
to ``GET`` regardless of the value of ``req.method``.
purge
Calls vcl_purge where the object will be purged.
vcl_
backend_fetch
vcl_
pipe
~~~~~~~~
~~~~~~~~~
~~~~~~~~
Called before sending the backend request. In this subroutine you
Called upon entering pipe mode. In this mode, the request is passed
typically alter the request before it gets to the backend.
on to the backend, and any further data from either client or backend
is passed on unaltered until either end closes the
connection. Basically, Varnish will degrade into a simple TCP proxy,
shuffling bytes back and forth.
.. XXX Return statements?
The vcl_pipe subroutine may terminate with calling return() with one
of the following keywords:
error code [reason]
Return the specified error code to the client and abandon the request.
vcl_backend_respons
e
pip
e
~~~~~~~~~~~~~~~~~~~
Proceed with pipe mode.
Called after a document has been successfully retrieved from the backend.
vcl_pass
~~~~~~~~
The vcl_backend_response subroutine may terminate with calling return() with one
Called upon entering pass mode. In this mode, the request is passed
of the following keywords:
on to the backend, and the backend's response is passed on to the
client, but is not entered into the cache. Subsequent requests
submitted over the same client connection are handled normally.
deliver
The vcl_pass subroutine may terminate with calling return() with one
Possibly insert the object into the cache, then deliver it to the
of the following keywords:
client. Control will eventually pass to vcl_deliver.
error
code
[reason]
error [reason]
Return the specified error code to the client and abandon the request.
Return the specified error code to the client and abandon the request.
hit_for_pass
pass
Pass in fetch. Passes the object without caching it. This will
Proceed with pass mode.
create a so-called hit_for_pass object which has the side effect
that the decision not to cache will be cached. This is to allow
restart
would-be uncachable requests to be passed to the backend at the
Restart the transaction. Increases the restart counter. If the number
same time. The same logic is not necessary in vcl_recv because
of restarts is higher than *max_restarts* Varnish emits a guru meditation
this happens before any potential queueing for an object takes
error.
place. Note that the TTL for the hit_for_pass object will be set
to what the current value of beresp.ttl is. Control will be
handled to vcl_deliver on the current request, but subsequent
vcl_hit
requests will go directly to vcl_pass based on the hit_for_pass
~~~~~~~
object.
Called is a cache lookup is successful.
restart
restart
Restart the transaction. Increases the restart counter. If the number
Restart the transaction. Increases the restart counter. If the number
of restarts is higher than *max_restarts* Varnish emits a guru meditation
of restarts is higher than *max_restarts* Varnish emits a guru meditation
error.
error.
deliver
Deliver the object. Control passes to vcl_deliver.
error [reason]
Return the specified error code to the client and abandon the request.
vcl_miss
~~~~~~~~
Called after a cache lookup if the requested document was not found in
the cache. Its purpose is to decide whether or not to attempt to
retrieve the document from the backend, and which backend to use.
The vcl_miss subroutine may terminate with calling return() with one
of the following keywords:
error [reason]
Return the specified error code to the client and abandon the request.
pass
Switch to pass mode. Control will eventually pass to vcl_pass.
fetch
Retrieve the requested object from the backend. Control will
eventually pass to vcl_fetch.
vcl_hash
~~~~~~~~
Called after vcl_recv to create a hash value for the request. This is
used as a key to look up the object in Varnish.
lookup
Look up the object in cache.
vcl_purge
~~~~~~~~~
Purge the object and all it's variants. Variants created when the
backend issues a Vary response.
fetch
Execute the purge.
error
Fail the purge request. Typically you would call error here it
request doesn't pass the ACLs.
vcl_deliver
vcl_deliver
~~~~~~~~~~~
~~~~~~~~~~~
...
@@ -97,83 +158,82 @@ keywords:
...
@@ -97,83 +158,82 @@ keywords:
of restarts is higher than *max_restarts* Varnish emits a guru meditation
of restarts is higher than *max_restarts* Varnish emits a guru meditation
error.
error.
vcl_backend_error
~~~~~~~~~~~~~~~~~
Called when we hit an error, either explicitly or implicitly due to
.. XXX
backend or internal errors.
.. vcl_error
.. ~~~~~~~~~
The vcl_backend_error subroutine may terminate by calling return with one of
.. Not sure if we're going to keep this around.
the following keywords:
deliver
Deliver the error object to the client.
restart
vcl_backend_fetch
Restart the transaction. Increases the restart counter. If the number
~~~~~~~~~~~~~~~~~
of restarts is higher than *max_restarts* Varnish emits a guru meditation
error.
Called before sending the backend request. In this subroutine you
typically alter the request before it gets to the backend.
vcl_pipe
fetch
~~~~~~~~
Fetch the object from the backend.
Called upon entering pipe mode. In this mode, the request is passed
abandon
on to the backend, and any further data from either client or
Abandon the backend request and generates an error.
backend is passed on unaltered until either end closes the
connection.
The vcl_pipe subroutine may terminate with calling return() with one of
vcl_backend_response
the following keywords:
~~~~~~~~~~~~~~~~~~~~
error code [reason]
Called after an response has been successfully retrieved from the
Return the specified error code to the client and abandon the request.
backend. The response is availble as beresp. Note that Varnish might
not be talking to an actual client, so operations that require a
client to be present are not allowed. Specifically there is no req
object and restarts are not allowed.
pip
e
The vcl_backend_response subroutine may terminate with calling return() with on
e
Proceed with pipe mode.
of the following keywords:
vcl_pass
deliver
~~~~~~~~
Possibly insert the object into the cache, then deliver it to the
Control will eventually pass to vcl_deliver. Caching is dependant
on beresp.cacheable.
Called upon entering pass mode. In this mode, the request is passed
error [reason]
on to the backend, and the backend's response is passed on to the
Return the specified error code to the client and abandon the request.
client, but is not entered into the cache. Subsequent requests
submitted over the same client connection are handled normally.
The vcl_pass subroutine may terminate with calling return() with one
retry
of the following keywords:
Retry the backend transaction. Increases the retries counter. If the number
of retries is higher than *max_retries* Varnish emits a guru meditation
error.
error code [reason]
vcl_backend_error
Return the specified error code to the client and abandon the request.
~~~~~~~~~~~~~~~~~
pass
This subroutine is called if we fail the backend fetch.
Proceed with pass mode.
restart
deliver
Restart the transaction. Increases the restart counter. If the number
Deliver the error.
of restarts is higher than *max_restarts* Varnish emits a guru meditation
error.
vcl_miss
retry
~~~~~~~~
Retry the backend transaction. Increases the retries counter. If the number
of retries is higher than *max_retries* Varnish emits a guru meditation
error.
Called after a cache lookup if the requested document was not found in
the cache. Its purpose is to decide whether or not to attempt to
retrieve the document from the backend, and which backend to use.
The vcl_miss subroutine may terminate with calling return() with one
vcl_backend_error
of the following keywords:
~~~~~~~~~~~~~~~~~
error code [reason]
Called when we hit an error, either explicitly or implicitly due to
Return the specified error code to the client and abandon the request
.
backend or internal errors
.
pass
The vcl_backend_error subroutine may terminate by calling return with one of
Switch to pass mode. Control will eventually pass to vcl_pass.
the following keywords:
fetch
deliver
Retrieve the requested object from the backend. Control will
Deliver the error object to the client.
eventually pass to vcl_fetch.
retry
Retry the backend transaction. Increases the retries counter. If the number
of retries is higher than *max_retries* Varnish emits a guru meditation
error.
vcl_init
vcl_init
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment