[Neo-report] r2715 jm - /trunk/neo/client/cache.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Apr 12 20:46:14 CEST 2011


Author: jm
Date: Tue Apr 12 20:46:14 2011
New Revision: 2715

Log:
client: give an example to adjust level of cached items according to their size

Modified:
    trunk/neo/client/cache.py

Modified: trunk/neo/client/cache.py
==============================================================================
--- trunk/neo/client/cache.py [iso-8859-1] (original)
+++ trunk/neo/client/cache.py [iso-8859-1] Tue Apr 12 20:46:14 2011
@@ -144,8 +144,10 @@ class ClientCache(object):
         self._remove(item)
         item.counter = counter = item.counter + 1
         # XXX It might be better to adjust the level according to the object
-        # size.
-        item.level = 1 + int(_log(counter, 2))
+        # size. See commented factor for example.
+        item.level = 1 + int(_log(counter, 2)
+                             # * (1.01 - float(len(item.data)) / self._max_size)
+                            )
         self._add(item)
 
         self._time = time = self._time + 1




More information about the Neo-report mailing list