From d03466ea102285814e8e5f151e0f87e6b6b0c541 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Fri, 3 Jan 2014 14:54:04 +0100 Subject: [PATCH] [entropy.db.cache] disable in-RAM cache if total memory is less than 4G --- lib/entropy/db/cache.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/entropy/db/cache.py b/lib/entropy/db/cache.py index e56ad7d56..6456b45c7 100644 --- a/lib/entropy/db/cache.py +++ b/lib/entropy/db/cache.py @@ -13,6 +13,8 @@ import weakref from entropy.core import Singleton +import entropy.tools + class EntropyRepositoryCacher(Singleton): """ @@ -88,4 +90,7 @@ class EntropyRepositoryCachePolicies(object): ALL, ) = range(2) - DEFAULT_CACHE_POLICY = ALL + if entropy.tools.total_memory() >= 4000: + DEFAULT_CACHE_POLICY = ALL + else: + DEFAULT_CACHE_POLICY = NONE