Commit b4864ef9 authored by Ivan Tyagov's avatar Ivan Tyagov

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.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23688 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9a751365
......@@ -93,7 +93,7 @@ class DistributedRamCache(BaseCache):
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 @@ class DistributedRamCache(BaseCache):
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 """
......
......@@ -69,8 +69,10 @@ class RamCache(BaseCache):
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 @@ class RamCache(BaseCache):
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()
......
......@@ -175,7 +175,7 @@ class SQLCache(BaseCache):
## 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 @@ class SQLCache(BaseCache):
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()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment