Skip to content

kelele0225/libvmod-var

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This VMOD implements basic variable in VCL. Well. It's more of an
association list with support for strings, ints and reals.

import var;

sub vcl_recv {

    # count the number of iDevices:
    if (req.http.user-agent ~ iP(od|ad|hone) ) {
       	var.set_int("idevs", var.get_int("i1") + 1 );
    }

There are methods to get and set each type.

Prototype, most should be self-explaining:

Function VOID set(STRING, STRING)
Function STRING get(STRING)

Function VOID global_set(STRING, STRING)
Function STRING global_get(STRING)

Function VOID set_int(STRING, INT)
Function INT get_int(STRING)

Function VOID set_string(STRING, STRING)
Function STRING get_string(STRING)

Function VOID set_real(STRING, REAL)
Function REAL get_real(STRING)

Function VOID set_duration(STRING, DURATION)
Function DURATION get_duration(STRING)

Function VOID clear()

clear() clears the whole variable space.

About

Variable support VMOD

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published