Move cache functions to plugin base

This commit is contained in:
Ruud
2011-10-18 00:29:56 +02:00
parent 54a99c7fa9
commit 019c9d4d76
2 changed files with 11 additions and 10 deletions
+11
View File
@@ -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()
-10
View File
@@ -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