Module: caf_redis/gen_redis_plug

Generic plug to manage a Redis connection.

Properties:

{nodeId: string=, paas: string, redis: {password: string|null,
                                       hostname: string, port: number},
 coalescing: {interval: number, maxPendingUpdates: number}}

where:

  • nodeId: is an optional, default identifier for the lease owner of all the CAs that use this plug. Mostly for debugging.
  • paas: a name for a service to dynamically lookup configuration that will override the one defined here.
  • interval: the number of miliseconds that we delay update requests, so that we can aggregate them in a single request.
  • maxPendingUpdates: The maximum number of pending updates before we flush them in a single request.
  • redis: standard Redis configuration.
Source:

Extends

Members

__ca_isRedisPlug__ :boolean

Run-time type information.

Type:
  • boolean
Source:

Methods

__ca_doLuaOp__(op, ids, argsList, cb)

Sends a LUA command to Redis.

Parameters:
Name Type Description
op string

Operation to perform.

ids Array.<string>

CA identifiers.

argsList Array.<Object>

Arguments to LUA command.

cb cbType

A callback called with the response to the LUA command.

Source:

__ca_flush__(flushF, force)

Flushes pending commands, combining them by using a given function.

Parameters:
Name Type Description
flushF function

A hook function of type function(Array.<Object>, cbType) to process a sequence of commands, and call a callback with the combined results or an error.

force boolean

True if we flush regardless of the number of pending updates. False, if we only flush when the threshold of queue size was exceeded.

Source:

__ca_getClientRedis__() → {Object}

Gets a connection to Redis.

Source:
Returns:

A connection to Redis.

Type
Object

__ca_initClient__(optConfigopt, lua, flushFopt, cb)

Initializes the Redis connection/LUA scripts. This can only be done once.

redisType type is

{port: number, hostname: string, password: string=}

Parameters:
Name Type Attributes Description
optConfig redisType <optional>

Optional host/port/password for redis service that overrides the defaults.

lua Object.<string, string>

A map with script names (keys) and LUA script source codes (values).

flushF function <optional>

An optional flush function to process pending updates.

cb cbType

A callback to continue after initialization.

Source:

__ca_ping__()

Sends a PING command to Redis.

Source:

__ca_queue__(callback, command)

Queues a callback/command pair for future execution, so that we can aggregate commands into a single LUA script.

Parameters:
Name Type Description
callback cbType

A callback to return results/error for the queued command.

command Object

A command to be queued for future execution.

Source: