From: Bill Stoddard Date: Thu, 7 Mar 2002 19:27:58 +0000 (+0000) Subject: Track cache size as items are added to and removed from the cache X-Git-Tag: CHANGES~197 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=77bf9d14e06c8becbfa9a799a0ac8288db9a303b;p=apache Track cache size as items are added to and removed from the cache git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93772 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/experimental/mod_mem_cache.c b/modules/experimental/mod_mem_cache.c index 86a46059b2..c3f0563f23 100644 --- a/modules/experimental/mod_mem_cache.c +++ b/modules/experimental/mod_mem_cache.c @@ -331,6 +331,7 @@ static int create_entity(cache_handle_t *h, request_rec *r, if (!tmp_obj) { apr_hash_set(sconf->cacheht, obj->key, strlen(obj->key), obj); sconf->object_cnt++; + sconf->cache_size += len; } if (sconf->lock) { apr_thread_mutex_unlock(sconf->lock); @@ -408,6 +409,7 @@ static int remove_entity(cache_handle_t *h) mem_cache_object_t *mobj = (mem_cache_object_t *) obj->vobj; apr_hash_set(sconf->cacheht, obj->key, strlen(obj->key), NULL); sconf->object_cnt--; + sconf->cache_size -= mobj->m_len; if (mobj->refcount) { mobj->cleanup = 1; } @@ -508,6 +510,7 @@ static int remove_url(const char *type, const char *key) mem_cache_object_t *mobj = (mem_cache_object_t *) obj->vobj; apr_hash_set(sconf->cacheht, key, APR_HASH_KEY_STRING, NULL); sconf->object_cnt--; + sconf->cache_size -= mobj->m_len; if (mobj->refcount) { mobj->cleanup = 1; }