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},
compressState: boolean}
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:
standardRedis
configuration.compressState
: Whether to compress checkpointed state. Typically turned off for debugging.
- Source:
Extends
Members
__ca_isRedisPlug__ :boolean
- Source:
Run-time type information.
Type:
- boolean
Methods
__ca_doLuaOp__(op, ids, argsList, cb)
- Source:
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. |
__ca_flush__(flushF, force)
- Source:
Flushes pending commands, combining them by using a given function.
Parameters:
Name | Type | Description |
---|---|---|
flushF |
function | A hook function
of type |
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. |
__ca_getClientRedis__() → {Object}
- Source:
Gets a connection to Redis.
Returns:
A connection to Redis.
- Type
- Object
__ca_initClient__(optConfigopt, lua, flushFopt, cb)
- Source:
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. |
__ca_ping__()
- Source:
Sends a PING command to Redis.
__ca_queue__(callback, command)
- Source:
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. |