A Varnish module that allows sending commands to redis from the VCL.
At this stage it is mostly a proof-of-concept; it has only received minimal testing and we have never used it in production. At the very minimum, it will slow down Varnish a fair amount (at least a few milliseconds per request, depending on how fast your network and your redis server are).
So far the module builds and runs on FreeBSD--on other platforms, you are on your own (pull requests welcome).
redis.init_redis(host, port, timeout_ms)
Use the redis server at the given host and port with a timeout of timeout__ms milliseconds. If port is less than or equal to zero, the default port of 6379 is used. If timeout__ms is less than or equal to zero, a default timeout of 200ms is used.
This function is supposed to be called from the Varnish subroutine vcl__init. If the call is left out, the module will attempt to connect to the Redis server at 127.0.0.1:6379 with a connect timeout of 200ms.
Sends the given command to redis; the response will be ignored.
Sends the given command to redis; any response will be returned as a string.
- hiredis (https://github.com/antirez/hiredis)
- sudo make install
See the examples folder.