PingAccess Agent SDK for C
Functions
paa-cache-zmq.h File Reference
#include "apr.h"
#include "apr_pools.h"
#include "paa-config.h"
#include "paa-cache.h"

Go to the source code of this file.

Functions

apr_status_t paa_cache_zmq_create (apr_pool_t *pool, const paa_config *config, const paa_cache **impl)
 

Detailed Description

Header for the paa_cache ZeroMQ implementation.

Function Documentation

apr_status_t paa_cache_zmq_create ( apr_pool_t *  pool,
const paa_config config,
const paa_cache **  impl 
)

Creates an instance of a cache using ZeroMQ.

This cache implementation uses ZeroMQ to share cache entries across PingAccess agents in other processes on the localhost. It is multithread-safe and uses ZeroMQ for all synchronization amongst threads.

When bounded, the cache evicts entries in LRU order once the configured maximum number of entries is reached. Eviction will bring the total number of entries below a configured high watermark.

Regardless of bound, the cache will also periodically sweep for stale entries, governed by a configurable search interval and a token search limit.

This implementation's invalidate_scope function only invalidates the scope for the local worker process, it makes no attempt to invalidate entries throughout the cache network.

This implementation expects the following keys from the configuration:

  • agent.cache.missInitialTimeout (required)
    • The amount of time in milliseconds to wait for a cache hit message from another agent process.
  • agent.cache.broker.publisherPort (required)
    • The port on which subscribers will connect to receive broadcast messages from other processes.
  • agent.cache.broker.subscriberPort (required)
    • The port on which the elected broker will listen for connections from subscribers.
  • agent.cache.disabled (optional)
    • Disables the cache when set to a non-zero value. All get requests will result in misses.
    • The default is 0 meaning the cache is enabled.
  • agent.cache.maxTokens (required)
    • The maximum number of sessions and associated agent responses that can be cached.
  • agent.cache.tokenHighWatermark (optional)
    • An integer percentage of the maxTokens that will be used as the high watermark in the eviction algorithm.
    • The value must be greater than or equal to 0 and less than 100
    • The default value is 90
  • agent.cache.eviction.interval (optional)
    • The interval in seconds at which the background threads will scan their caches for expired entries
    • The value must be greater than 0
    • The default value is 300
  • agent.cache.eviction.tokenSearchLimit (optional)
    • The number of entries to search, in LRU order, when periodically evicting expired cache entries.
    • The value must be greater than 0
    • The default value is 100
Parameters
poolthe pool in which to allocate the structure
configthe configuration used to configure the implementation
implthe output, populated on success
Returns
APR_SUCCESS on success