Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mnutt/libvmod-cachehits
Varnish vmod for notifying backend of previous cache hit rate for stale objects
https://github.com/mnutt/libvmod-cachehits
Last synced: about 2 months ago
JSON representation
Varnish vmod for notifying backend of previous cache hit rate for stale objects
- Host: GitHub
- URL: https://github.com/mnutt/libvmod-cachehits
- Owner: mnutt
- License: unlicense
- Created: 2021-12-25T21:38:30.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-08-26T20:42:27.000Z (4 months ago)
- Last Synced: 2024-08-26T23:08:30.148Z (4 months ago)
- Language: M4
- Size: 105 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES.rst
- License: COPYING
Awesome Lists containing this project
README
============
vmod-cachehits
============SYNOPSIS
========import cachehits;
DESCRIPTION
===========Varnish vmod to enable hinting to the backend the number of previous cache hits.
The intended usage is for the backend to notice that an object has a high cache hit rate and run additional optimizations. (for example, higher png compression level)
FUNCTIONS
=========Prototype
::count()
Return value
INT
Description
Returns number of cache hits for stale object
CacheHits
::set bereq.http.Cache-Hits = cachehits.count();
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
./configureIf 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/aclocalThe 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
makeInstallation 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 cachehits;
sub vcl_backend_fetch {
set bereq.http.Cache-Hits = cachehits.count();
}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.