cache_handler: Maintains a cache of data for use by lower level handlers.(3)

NAME
cache_handler: Maintains a cache of data for use by lower level handlers. - This helper checks to see whether the data has been loaded 'recently' (according to the timeout for that particular cache) and calls the registered 'load_cache' routine if necessary. More...

  Functions
netsnmp_mib_handler * netsnmp_get_cache_handler (int timeout, NetsnmpCacheLoad *load_hook, NetsnmpCacheFree *free_hook, oid *rootoid, int rootoid_len)
returns a cache handler that can be injected into a given handler chain.
int netsnmp_register_cache_handler (netsnmp_handler_registration *reginfo, int timeout, NetsnmpCacheLoad *load_hook, NetsnmpCacheFree *free_hook)
functionally the same as calling netsnmp_register_handler() but also injects a cache handler at the same time for you.
netsnmp_cache * netsnmp_extract_cache_info (netsnmp_agent_request_info *reqinfo)
Extract the cache information for a given request.
int netsnmp_is_cache_valid (netsnmp_agent_request_info *reqinfo)
Is the cache valid for a given request?
int netsnmp_cache_helper_handler (netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)
Implements the cache handler.
void release_cached_resources (unsigned int regNo, void *clientargs)
run regularly to automatically release cached resources.

DETAILED DESCRIPTION

This helper checks to see whether the data has been loaded 'recently' (according to the timeout for that particular cache) and calls the registered 'load_cache' routine if necessary.

The lower handlers can then work with this local cached data.

FUNCTION DOCUMENTATION

  int netsnmp_cache_helper_handler (netsnmp_mib_handler * handler, netsnmp_handler_registration * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests)

Implements the cache handler.

Definition at line 107 of file cache_handler.c.

References atime_newMarker(), atime_ready(), atime_setMarker(), netsnmp_agent_request_info_s::mode, netsnmp_mib_handler_s::myvoid, netsnmp_call_next_handler(), netsnmp_create_data_list(), release_cached_resources(), netsnmp_handler_registration_s::rootoid, netsnmp_handler_registration_s::rootoid_len, snmp_alarm_register(), and snmp_log().

Referenced by netsnmp_get_cache_handler().

  netsnmp_cache* netsnmp_extract_cache_info (netsnmp_agent_request_info * reqinfo)

Extract the cache information for a given request.

Definition at line 92 of file cache_handler.c.

Referenced by netsnmp_is_cache_valid().

  netsnmp_mib_handler* netsnmp_get_cache_handler (int timeout, NetsnmpCacheLoad * load_hook, NetsnmpCacheFree * free_hook, oid * rootoid, int rootoid_len)

returns a cache handler that can be injected into a given handler chain.

Definition at line 39 of file cache_handler.c.

References netsnmp_mib_handler_s::myvoid, netsnmp_cache_helper_handler(), netsnmp_create_handler(), and SNMP_MALLOC_TYPEDEF.

Referenced by netsnmp_register_cache_handler().

  int netsnmp_is_cache_valid (netsnmp_agent_request_info * reqinfo)

Is the cache valid for a given request?

Definition at line 99 of file cache_handler.c.

References netsnmp_extract_cache_info().

  int netsnmp_register_cache_handler (netsnmp_handler_registration * reginfo, int timeout, NetsnmpCacheLoad * load_hook, NetsnmpCacheFree * free_hook)

functionally the same as calling netsnmp_register_handler() but also injects a cache handler at the same time for you.

Definition at line 78 of file cache_handler.c.

References netsnmp_get_cache_handler(), netsnmp_inject_handler(), netsnmp_register_handler(), netsnmp_handler_registration_s::rootoid, and netsnmp_handler_registration_s::rootoid_len.

  void release_cached_resources (unsigned int regNo, void * clientargs)

run regularly to automatically release cached resources.

Definition at line 206 of file cache_handler.c.

References atime_ready(), release_cached_resources(), and snmp_alarm_register().

Referenced by netsnmp_cache_helper_handler(), and release_cached_resources().