cache

module:cache

Description:
  • Cache module for shared cache and subscriptions.

    Some drivers (Redis) may support TTL so global options.ttl or local options.ttl can be used for put/incr operations and it will honored if it is suported.

    For caches that support maps, like Redis the options.mapName can be used with get/put/incr/del to work with maps and individual keys inside maps.

    All methods use options.cacheName for non-default cache. If it is an array then a client will be picked sequentially by maintaining internal sequence number.

    Empty default client always exists, it can be overridden to make default some other driver

    All public cache.get|put|incr|del|lock|unlock|limiter operations have corresponding promisifed methods starting with a, like cache.get -> cache.aget.

    To enable stats collection for a cache it must be enabled with config: cache-redis-options-metrics=1

Example
cache-default=redis://
cache-redis=redis://?bk-enable_offline_queue=1
cache-config={ "limiter": "local://", "redis": "redis://" }

Classes

CacheClient
LocalClient
RedisClient
WorkerClient

Members

(inner) args :Array.<ConfigOptions>

Type: