The dr_cache_init function creates a persistent handle to the cache, or NULL on failure. This function is called by an Init SAF.
PRInt32 dr_cache_init(DrHdl *hdl, RefreshFunc_t ref, FreeFunc_t fre,
CompareFunc_t cmp, PRUint32 maxEntries,
PRIntervalTime maxAge);
1 if successful.
0 if an error occurs.
The following table describes parameters for the dr_cache_init function.
Pointer to an unallocated handle.
Pointer to a cache refresh function. This value can be NULL. See the DR_CHECK flag and DR_EXPIR return value for dr_net_write.
Pointer to a function that frees an entry.
Pointer to a key comparator function.
Maximum number of entries possible in the cache for a given hdl.
The maximum amount of time that an entry is valid. If 0, the cache never expires.
if(!dr_cache_init(&hdl, (RefreshFunc_t)FnRefresh, (FreeFunc_t)FnFree,
(CompareFunc_t)FnCompare, 150000, PR_SecondsToInterval(7200)))
{
ereport(LOG_FAILURE, "dr_cache_init() failed");
return(REQ_ABORTED);
}