Move cache functions to plugin base
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user