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

Section: C Library Functions (3)
Updated: 7 Aug 2004
 

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.

 

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 108 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(), netsnmp_handler_registration, release_cached_resources(), netsnmp_handler_registration_s::rootoid, netsnmp_handler_registration_s::rootoid_len, snmp_alarm_register(), and snmp_log().  

netsnmp_cache* netsnmp_extract_cache_info (netsnmp_agent_request_info * reqinfo)

Extract the cache information for a given request. Definition at line 93 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 40 of file cache_handler.c.

References netsnmp_mib_handler_s::myvoid, netsnmp_create_handler(), netsnmp_mib_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 100 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 79 of file cache_handler.c.

References netsnmp_get_cache_handler(), netsnmp_inject_handler(), netsnmp_mib_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 207 of file cache_handler.c.

Referenced by netsnmp_cache_helper_handler().


 

Index

NAME
Functions
Detailed Description
Function Documentation
int netsnmp_cache_helper_handler (netsnmp_mib_handler * handler, netsnmp_handler_registration * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests)
netsnmp_cache* netsnmp_extract_cache_info (netsnmp_agent_request_info * reqinfo)
netsnmp_mib_handler* netsnmp_get_cache_handler (int timeout, NetsnmpCacheLoad * load_hook, NetsnmpCacheFree * free_hook, oid * rootoid, int rootoid_len)
int netsnmp_is_cache_valid (netsnmp_agent_request_info * reqinfo)
int netsnmp_register_cache_handler (netsnmp_handler_registration * reginfo, int timeout, NetsnmpCacheLoad * load_hook, NetsnmpCacheFree * free_hook)
void release_cached_resources (unsigned int regNo, void * clientargs)
blog comments powered by Disqus