diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-08-01 11:22:27 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-08-01 11:36:20 +0300 |
commit | d7399e572e334fb036c7f6b59400f5075147054c (patch) | |
tree | 868c700aa625ab8d413a4191ec3c6cc61b72e5ad /src/vmod_dict.vcc | |
download | vmod-dict-d7399e572e334fb036c7f6b59400f5075147054c.tar.gz vmod-dict-d7399e572e334fb036c7f6b59400f5075147054c.tar.bz2 |
Initial commit
Diffstat (limited to 'src/vmod_dict.vcc')
-rw-r--r-- | src/vmod_dict.vcc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/vmod_dict.vcc b/src/vmod_dict.vcc new file mode 100644 index 0000000..76c4267 --- /dev/null +++ b/src/vmod_dict.vcc @@ -0,0 +1,37 @@ +$Module dict 3 Dictionary look-up for Varnish Cache + +DESCRIPTION +=========== + +Provides simple key/value dictionary API. The dictionary is kept in +a disk file. Each non-empty line in such a file is either a comment +or a pair of keyword - value separated by one or more whitespace characters. +Leading and trailing whitespace is discarded. Comments are introduced by a +hash sign at the beginning of the line. Empty lines and comments are ignored. + +$Function VOID load(STRING file, BOOL ci, INT ncls) + +Description + Loads key/value dictionary from **file** into memory. The **ci** + parameter controls whether key lookups should be case-insensitive. + The **ncls** parameter, if positive, gives the maximum allowable length + of collision chain in the hash table. The module will adjust the hash + load factor to ensure thes number of collisions doesn't exceed this + value. + + This function is normally called from **vcl_init**. + +$Function STRING lookup(STRING key) + +Description + Looks up the **key** in the table loaded by the **dict.load**. + Returns the value if found, or **NULL** otherwise. + +COPYRIGHT +========= + +| Copyright (C) Sergey Poznyakoff +| License GPLv3+: GNU GPL version 3 or later +| <http://gnu.org/licenses/gpl.html> +| This is free software: you are free to change and redistribute it. +| There is NO WARRANTY, to the extent permitted by law. |