109.26. Redis (im_redis)
This module can retrieve data stored in a Redis server. The module issues LPOP commands using the Redis Protocol to pull data.
The output counterpart, om_redis, can be used to populate the Redis server with data.
109.26.1. Configuration
The im_redis module accepts the following directives in addition to the common module directives. The Host directive is required.
- Host
-
This mandatory directive specifies the IP address or DNS hostname of the Redis server to connect to.
- Channel
-
This optional directive defines the Redis channel this module will subscribe to. This directive can be specified multiple times within the module definition. When the Command directive is set to
PSUBSCRIBE
, each Channel directive specifies a glob that will be matched by the Redis server against its available channels. For theSUBSCRIBE
command, Channel specifies the channel names which will be matched as is (no globbing). The usage of this directive is mutually exclusive with the usage of theLPOP
andRPOP
commands in the Command directive.
- Command
-
This optional directive can be used to choose between the LPOP, RPOP, SUBSCRIBE and PSUBSCRIBE commands. The default Command is set to LPOP, if this directive is not specified.
- InputType
-
See the InputType directive in the list of common module directives. The default is the
Dgram
reader function, which expects a plain string. To preserve structured dataBinary
can be used, but it must also be set on the other end.
- PollInterval
-
This directive specifies how frequently the module will check for new data, in seconds. If this directive is not specified, the default is 1 second. Fractional seconds may be specified (
PollInterval 0.5
will check twice every second). The usage of this directive is mutually exclusive with the usage of theSUBSCRIBE
andPSUBSCRIBE
commands in the Command directive.
- Port
-
This specifies the port number of the Redis server. The default is port 6379.