Move cache functions to plugin base
This commit is contained in:
1 parent
54a99c7fa9
commit
019c9d4d76
2 files changed
+11
-10
No files matched your search
@@ -158,6 +158,17 @@ class Plugin(object):
|
|||||||
except:
|
except:
|
||||||
log.error("Something went wrong when finishing the plugin function. Could not find the 'is_running' key")
|
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):
|
def isDisabled(self):
|
||||||
return not self.isEnabled()
|
return not self.isEnabled()
|
||||||
|
|
||||||
|
|||||||
@@ -17,16 +17,6 @@ class Provider(Plugin):
|
|||||||
last_available_check = {}
|
last_available_check = {}
|
||||||
is_available = {}
|
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):
|
def isAvailable(self, test_url):
|
||||||
|
|
||||||
if Env.get('debug'): return True
|
if Env.get('debug'): return True
|
||||||
|
|||||||
Reference in new issue
Block a user