[Erp5-report] r23688 - /erp5/trunk/products/ERP5Type/CachePlugins/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Sep 18 09:46:14 CEST 2008


Author: ivan
Date: Thu Sep 18 09:46:13 2008
New Revision: 23688

URL: http://svn.erp5.org?rev=23688&view=rev
Log:
Do not explicitly mark a cache hit or miss. 
Because this information is not yet used for cache management this is unnecessary
and introduces uneeded function call. 
Leave though commented methods for future reference / usage.

Modified:
    erp5/trunk/products/ERP5Type/CachePlugins/DistributedRamCache.py
    erp5/trunk/products/ERP5Type/CachePlugins/RamCache.py
    erp5/trunk/products/ERP5Type/CachePlugins/SQLCache.py

Modified: erp5/trunk/products/ERP5Type/CachePlugins/DistributedRamCache.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/CachePlugins/DistributedRamCache.py?rev=23688&r1=23687&r2=23688&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/CachePlugins/DistributedRamCache.py (original)
+++ erp5/trunk/products/ERP5Type/CachePlugins/DistributedRamCache.py Thu Sep 18 09:46:13 2008
@@ -93,7 +93,7 @@
     cache_storage = self.getCacheStorage()
     cache_id = self.checkAndFixCacheId(cache_id, scope)
     cache_entry = cache_storage.get(cache_id)
-    self.markCacheHit()
+    #self.markCacheHit()
     return cache_entry
        
   def set(self, cache_id, scope, value, cache_duration= None, calculation_time=0):
@@ -105,7 +105,7 @@
       cache_duration = 360000
     cache_entry = CacheEntry(value, cache_duration, calculation_time)
     cache_storage.set(cache_id, cache_entry, cache_duration)
-    self.markCacheMiss()
+    #self.markCacheMiss()
    
   def expireOldCacheEntries(self, forceCheck = False):
     """ Memcache has its own built in expire policy """

Modified: erp5/trunk/products/ERP5Type/CachePlugins/RamCache.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/CachePlugins/RamCache.py?rev=23688&r1=23687&r2=23688&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/CachePlugins/RamCache.py (original)
+++ erp5/trunk/products/ERP5Type/CachePlugins/RamCache.py Thu Sep 18 09:46:13 2008
@@ -69,8 +69,10 @@
     cache = self.getCacheStorage()
     try:
       cache_entry = cache[(scope, cache_id)]
-      cache_entry.markCacheHit()
-      self.markCacheHit()
+      # Note: tracking down cache hit could be achieved by uncommenting
+      # methods below. In production environment this is likely uneeded
+      #cache_entry.markCacheHit()
+      #self.markCacheHit()
       return cache_entry
     except KeyError:
       pass
@@ -79,7 +81,7 @@
   def set(self, cache_id, scope, value, cache_duration=None, calculation_time=0):
     cache = self.getCacheStorage()
     cache[(scope, cache_id)] = CacheEntry(value, cache_duration, calculation_time)
-    self.markCacheMiss()
+    #self.markCacheMiss()
 
   def expireOldCacheEntries(self, forceCheck = False):
     now = time.time()

Modified: erp5/trunk/products/ERP5Type/CachePlugins/SQLCache.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/CachePlugins/SQLCache.py?rev=23688&r1=23687&r2=23688&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/CachePlugins/SQLCache.py (original)
+++ erp5/trunk/products/ERP5Type/CachePlugins/SQLCache.py Thu Sep 18 09:46:13 2008
@@ -175,7 +175,7 @@
         ## we found results
         result = result[0]
         decoded_result = pickle.loads(base64.decodestring(result[0]))
-        self.markCacheHit()
+        #self.markCacheHit()
         cache_entry = CacheEntry(decoded_result, result[1], result[2])
         return cache_entry
       else:
@@ -197,7 +197,7 @@
     stored_at = int(time.time())
     sql_query = self.insert_key_sql %(self._db_cache_table_name, cache_id, value, scope, stored_at, cache_duration, calculation_time)
     self.execSQLQuery(sql_query)
-    self.markCacheMiss()
+    #self.markCacheMiss()
             
   def expireOldCacheEntries(self, forceCheck = False):
     now = time.time()




More information about the Erp5-report mailing list