void RivetCache_Cleanup()

in src/mod_rivet_ng/mod_rivet_cache.c [98:135]


void RivetCache_Cleanup (rivet_thread_private* private,rivet_thread_interp* rivet_interp)
{
    int ct;
    Tcl_HashEntry *delEntry;

    /* Clean out the list. */
    ct = rivet_interp->cache_free;
    while (ct < rivet_interp->cache_size) {
        /* Free the corresponding hash entry. */
        delEntry = Tcl_FindHashEntry(rivet_interp->objCache,
                                     rivet_interp->objCacheList[ct]);

        if (delEntry != NULL) {
            Tcl_DecrRefCount((Tcl_Obj *)Tcl_GetHashValue(delEntry));
            Tcl_DeleteHashEntry(delEntry);
            rivet_interp->objCacheList[ct] = NULL;
        }

        ct++;
    }
    apr_pool_destroy(rivet_interp->pool);

    /* let's recreate the cache list */

    if (apr_pool_create(&rivet_interp->pool, private->pool) != APR_SUCCESS)
    {
        ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, module_globals->server,
                     MODNAME ": could not recreate cache private pool. Cache disabled");
        rivet_interp->cache_free = rivet_interp->cache_size = 0;
    }
    else
    {
        rivet_interp->objCacheList = apr_pcalloc (rivet_interp->pool,
                                                (signed)(rivet_interp->cache_size*sizeof(char *)));
        rivet_interp->cache_free = rivet_interp->cache_size;
    }

}