Hi

> JNL> But how do I flush the cache manually?
> 
> Good question.  I'll make sure to add an API to do this for the next release.
> 
> If you look in the interface file, at _cache_free and _cache_item_free, you'll
> get the basic idea. Go through the container and release any memory you
> allocated, then let the MFD code do the same for memory it allocated.
> 

Ok I made the two function copy/pasted below in xxx_data_access.c.
They're almost identical to the functions in the interface file. When
I want to flush the cache I call
noiseTimeTable_man_cache_free(container) in my xxx_cache_load funtion.
It seems to work just fine :)

Thanks for fast support... :)

/Jon 

/*
 * Functions to manually flush the cache
 */
void
noiseTimeTable_man_cache_item_free(noiseTimeTable_rowreq_ctx *
rowreq_ctx, void *context)
{
        DEBUGMSGTL(("noiseTimeTable:noiseTimeTable:man__cache_item_free", 
"called\n"));

    if (NULL == rowreq_ctx)
        return;

    noiseTimeTable_release_rowreq_ctx(rowreq_ctx);
}                               /* _cache_item_free */

void
noiseTimeTable_man_cache_free(netsnmp_container * container)
{

    DEBUGMSGTL(("noiseTimeTable:_man_cache_free", "called\n"));

    if (NULL == container) {
        snmp_log(LOG_ERR, "invalid cache in noiseTimeTable_man_cache_free\n");
        return;
    }

    /*
     * call user code
     */
    noiseTimeTable_cache_free(container);

    /*
     * free all items. inefficient, but easy.
     */
    CONTAINER_CLEAR(container,
                    (netsnmp_container_obj_func *)
noiseTimeTable_man_cache_item_free, NULL);
}


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to