From 019c9d4d764996a5041eb86329ae031e0610d14e Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 18 Oct 2011 00:29:56 +0200 Subject: [PATCH] Move cache functions to plugin base --- couchpotato/core/plugins/base.py | 11 +++++++++++ couchpotato/core/providers/base.py | 10 ---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/couchpotato/core/plugins/base.py b/couchpotato/core/plugins/base.py index de64c6d0..ef38d565 100644 --- a/couchpotato/core/plugins/base.py +++ b/couchpotato/core/plugins/base.py @@ -158,6 +158,17 @@ class Plugin(object): except: log.error("Something went wrong when finishing the plugin function. Could not find the 'is_running' key") + + def getCache(self, cache_key): + cache = Env.get('cache').get(cache_key) + if cache: + log.debug('Getting cache %s' % cache_key) + return cache + + def setCache(self, cache_key, value, timeout = 300): + log.debug('Setting cache %s' % cache_key) + Env.get('cache').set(cache_key, value, timeout) + def isDisabled(self): return not self.isEnabled() diff --git a/couchpotato/core/providers/base.py b/couchpotato/core/providers/base.py index b4346fb6..199f4248 100644 --- a/couchpotato/core/providers/base.py +++ b/couchpotato/core/providers/base.py @@ -17,16 +17,6 @@ class Provider(Plugin): last_available_check = {} is_available = {} - def getCache(self, cache_key): - cache = Env.get('cache').get(cache_key) - if cache: - log.debug('Getting cache %s' % cache_key) - return cache - - def setCache(self, cache_key, value, timeout = 300): - log.debug('Setting cache %s' % cache_key) - Env.get('cache').set(cache_key, value, timeout) - def isAvailable(self, test_url): if Env.get('debug'): return True