aboutsummaryrefslogtreecommitdiff
path: root/src/vmod_dict.vcc
blob: 76c4267dba666724f1f6f29294bae1d893926276 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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.

Return to:

Send suggestions and report system problems to the System administrator.