# Copyright (c) 2015 UPLEX - Nils Goroll Systemoptimierung
# Copyright (c) 2015-2016 UPLEX - Nils Goroll Systemoptimierung
# All rights reserved.
#
# Author: Julian Wiesener <jw@uplex.de>
...
...
@@ -28,15 +28,104 @@
$Module vtstor 3 Generic hash-based key/value store VMOD
$Object vtstor(INT, INT, INT, INT)
$Method VOID .store(STRING, HEADER)
DESCRIPTION
===========
Temporary key-value storage for vcl. If not explicit deleted, pairs might get replaced after the configured timeout, if the slot is needed by a new pair. As the storage is available everywhere in vlc, it allows to transport values where it would not be possible otherwise for example cookies from responses to consecutive ESI requests. The storage is a hash table with a list per bucket. There are no global locks thus contention happens only if multiple thread access the same bucket at the same time.
$Object vtstor(
INT nbuckets = 1024,
INT timeout = 60,
INT keymax = 64,
INT valmax = 4096)
Description
Create vtstor instance.
- *nbuckets* (defaults to ``1024``)
- *timeout* in seconds (defaults to ``60``)
- *keymax* maximum key length (defaults to ``64``)
- *valmax* maximum value length (defaults to ``64``)
$Method VOID .store(
STRING value,
HEADER key)
Description
Store key-value pair.
- *value*
- *key*
$Method STRING .get(HEADER)
Description
Return value for key.
$Method VOID .delete(HEADER)
Description
Delete value for key.
$Method INT .buckets()
Description
Return the configured number of buckets.
$Method INT .timeout()
Description
Return the configured timeout.
$Method INT .key_max()
Description
Return the configured maximum key length.
$Method INT .value_max()
Description
Return the configured maximum value length.
$Function STRING vxid()
Description
Return the varnish vxid(Varnish Transaction ID) which can be used as key.