Commit 7acaae62 authored by Nils Goroll's avatar Nils Goroll

straighten the vmod PRIV_* doc

parent 09628c73
...@@ -234,28 +234,29 @@ It is often useful for library functions to maintain local state, ...@@ -234,28 +234,29 @@ It is often useful for library functions to maintain local state,
this can be anything from a precompiled regexp to open file descriptors this can be anything from a precompiled regexp to open file descriptors
and vast data structures. and vast data structures.
The VCL compiler supports three levels of private pointers, "per The VCL compiler supports the following private pointers:
call", "per VCL" and "per task".
* ``PRIV_CALL`` "per call" private pointers are useful to cache/store
"per call" private pointers are useful to cache/store state relative state relative to the specific call or its arguments, for instance a
to the specific call or its arguments, for instance a compiled regular compiled regular expression specific to a regsub() statement or a
expression specific to a regsub() statement or a simply caching the simply caching the last output of some expensive lookup.
last output of some expensive lookup.
* ``PRIV_VCL`` "per vcl" private pointers are useful for such global
"per vcl" private pointers are useful for such global state that state that applies to all calls in this VCL, for instance flags that
applies to all calls in this VCL, for instance flags that determine determine if regular expressions are case-sensitive in this vmod or
if regular expressions are case-sensitive in this vmod or similar. similar.
"per task" private pointers are useful for state that applies to calls * ``PRIV_TASK`` "per task" private pointers are useful for state that
for either a specific request or a backend request. For instance this applies to calls for either a specific request or a backend
can be the result of a parsed cookie specific to a client. Note that request. For instance this can be the result of a parsed cookie
"per task" contexts are separate for the client side and the backend specific to a client. Note that ``PRIV_TASK`` contexts are separate
side, so use in ``vcl_backend_*`` will yield a different private pointer for the client side and the backend side, so use in
from the one used on the client side. ``vcl_backend_*`` will yield a different private pointer from the
one used on the client side.
The way it works in the vmod code, is that a ``struct vmod_priv *`` is The way it works in the vmod code, is that a ``struct vmod_priv *`` is
passed to the functions where argument type PRIV_VCL, PRIV_CALL or passed to the functions where one of the ``PRIV_*`` argument types is
PRIV_TASK is specified. specified.
This structure contains two members:: This structure contains two members::
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment