inverse-inc/packetfence — pull request #210 by mullagain (2014-08-04 22:11:09+00:00)
Title: Feature/redis

Added pf::ipc module to extend Redis::Fast. It is also using Sereal for data serialization.

I have implemented the following methods.
enqueue - add a string/hash/array to a redis list (perl push). Auto serialization
dequeue - pull something off of a redis list (perl shift). Auto serialization.
queueCount - get a count of items on a redis list.
pfpublish - redis publish with automatic serialization
pfSubscribeHander - de-serialization of a published method (used with subscribe)
cache - Similar to CHI's compute method only in Redis and very simple. (probably needs work).
lcache - Same as cache accept process specific. The "l" stands for local. It prepends the pid to the key.

I have also included sbin/pftrapp that uses the native perl extension features of snmptrapd. This script breaks a trap into a hash and publishes it. This could work similar to tailing a log file, but a lot less complex and very fast as it all happens in memory.

Redis should be configured to be persistent in this case, and if there is a standby server redis should be configured with a slave.

This should greatly improve any ipc in terms of complexity and speed. It should also allow us to move away from the very slow and inefficient threaded perl.

It should also help with the active/active initiative as we could move more of the config into redis (SQL is overkill and inefficient for config imho)

I probably need more documentation, logging and add support for redis sentinels.

For review, discussion and merge.