caf_redis 0.3.1

CAF.js (Cloud Assistant Framework)

Co-design permanent, active, stateful, reliable cloud proxies with your web app and gadgets.

See http://www.cafjs.com

CAF Redis

Build Status

This library provides components to checkpoint the state of CAs using Redis.

CAF Redis uses a lease-based mechanism to ensure that at most one instance of a particular CA is active in the data centre. This keeps CA state consistent.

Lease ownership is based on a unique id associated with the CA hosting node.js process. This process should also ensure uniqueness for its own CAs.

Only the owner can read, update, or permanently delete the CA state.

A hosting node.js process is responsible to periodically renew leases for its CAs. If the node.js process dies, leases would expire, and another process can take over. Operations always check first that the lease is current, and fail otherwise. This is done atomically using LUA scripts executed by Redis.

To improve performance we aggregate both state updates and lease renewals from several local CAs in a single LUA request. To increase granularity of these group commits, we synchronize lease renewals and introduce an update delay in the client.


This is an internal API for other services. Application code should not use it directly.

See module:caf_redis/plug_checkpoint



See module:caf_redis/gen_redis_plug