Code Monkey home page Code Monkey logo

libvmod-hiring's Introduction

vmod-hiring

SYNOPSIS

import hiring;

DESCRIPTION

Hiring Varnish vmod, a vmod providing a count() function to count occurences of needle in a haystack.

FUNCTIONS

count

Prototype
count(STRING haystack, STRING needle)
Return value
INT
Description
Returns integer value representing occurences of needle in haystack
Hiring
set resp.http.hello = hiring.count("Example", "xa");

INSTALLATION

The source tree is based on autotools to configure the building, and does also have the necessary bits in place to do functional unit tests using the varnishtest tool.

Building requires the Varnish header files and uses pkg-config to find the necessary paths.

Usage:

./autogen.sh
./configure

If you have installed Varnish to a non-standard directory, call autogen.sh and configure with PKG_CONFIG_PATH pointing to the appropriate path. For instance, when varnishd configure was called with --prefix=$PREFIX, use

export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
export ACLOCAL_PATH=${PREFIX}/share/aclocal

The module will inherit its prefix from Varnish, unless you specify a different --prefix when running the configure script for this module.

Make targets:

  • make - builds the vmod.
  • make install - installs your vmod.
  • make check - runs the unit tests in src/tests/*.vtc.
  • make distcheck - run check and prepare a tarball of the vmod.

If you build a dist tarball, you don't need any of the autotools or pkg-config. You can build the module simply by running:

./configure
make

Installation directories

By default, the vmod configure script installs the built vmod in the directory relevant to the prefix. The vmod installation directory can be overridden by passing the vmoddir variable to make install.

USAGE

In your VCL you could then use this vmod along the following lines:

import hiring;

sub vcl_deliver {
        # This checks how many occurances of "e" is in the word "jalapeno"
        set resp.http.jalapeno = hiring.count("jalapeno", "e");
}

COMMON PROBLEMS

  • configure: error: Need varnish.m4 -- see README.rst

    Check whether PKG_CONFIG_PATH and ACLOCAL_PATH were set correctly before calling autogen.sh and configure

  • Incompatibilities with different Varnish Cache versions

    Make sure you build this vmod against its correspondent Varnish Cache version. For instance, to build against Varnish Cache 4.1, this vmod must be built from branch 4.1.

START YOUR OWN VMOD

The basic steps to start a new vmod from this hiring are:

name=myvmod
git clone libvmod-hiring libvmod-$name
cd libvmod-$name
./rename-vmod-script $name

and follow the instructions output by rename-vmod-script

https://circleci.com/gh/varnishcache/libvmod-hiring/tree/master.svg?style=svg

libvmod-hiring's People

Contributors

nigoroll avatar dridi avatar mbgrydeland avatar gransmango avatar daghf avatar aondio avatar kristianlyng avatar gquintard avatar xcir avatar perbu avatar rezan avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.