cache.ram.max_ram_utilization = 90
This commit is contained in:
+2
-1
@@ -96,6 +96,7 @@ class CacheAbstract(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
cache_stats_name = 'web2py_cache_statistics'
|
cache_stats_name = 'web2py_cache_statistics'
|
||||||
|
max_ram_utilization = 90 # percent
|
||||||
|
|
||||||
def __init__(self, request=None):
|
def __init__(self, request=None):
|
||||||
"""Initializes the object
|
"""Initializes the object
|
||||||
@@ -248,7 +249,7 @@ class CacheInRam(CacheAbstract):
|
|||||||
self.storage[key] = (now, value)
|
self.storage[key] = (now, value)
|
||||||
self.stats[self.app]['misses'] += 1
|
self.stats[self.app]['misses'] += 1
|
||||||
if HAVE_PSUTIL:
|
if HAVE_PSUTIL:
|
||||||
remove_oldest_entries(self.storage)
|
remove_oldest_entries(self.storage, percentage = self.max_ram_utilization)
|
||||||
self.locker.release()
|
self.locker.release()
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user