From 8dcfc6cbee8460d92e8c817988a12890df60ab1f Mon Sep 17 00:00:00 2001
From: Ivan Tyagov <ivan@nexedi.com>
Date: Fri, 5 Oct 2007 07:58:21 +0000
Subject: [PATCH] Extend statistics, return dictionary of
 cache_key:memory_used.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16845 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/CachePlugins/RamCache.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/product/ERP5Type/CachePlugins/RamCache.py b/product/ERP5Type/CachePlugins/RamCache.py
index 607908aaeb..bbf4a8e29b 100644
--- a/product/ERP5Type/CachePlugins/RamCache.py
+++ b/product/ERP5Type/CachePlugins/RamCache.py
@@ -135,7 +135,9 @@ class RamCache(BaseCache):
     from guppy import hpy
     h = hpy()
     total_size = 0
+    cache_keys_total_size = {}
     for cache_key, cache_value in self._cache_dict[DEFAULT_CACHE_SCOPE].items():
-      cache_value = cache_value.getValue()
-      total_size += calcPythonObjectMemorySize(h, cache_value)
-    return total_size      
+      cache_item_size = calcPythonObjectMemorySize(h, cache_value.getValue())
+      total_size += cache_item_size
+      cache_keys_total_size[cache_key] = cache_item_size
+    return total_size, cache_keys_total_size    
-- 
2.30.9