Don't cache post requests
This commit is contained in:
@@ -244,11 +244,15 @@ class Plugin(object):
|
||||
log.error("Something went wrong when finishing the plugin function. Could not find the 'is_running' key")
|
||||
|
||||
def getCache(self, cache_key, url = None, **kwargs):
|
||||
cache_key_md5 = md5(cache_key)
|
||||
cache = Env.get('cache').get(cache_key_md5)
|
||||
if cache:
|
||||
if not Env.get('dev'): log.debug('Getting cache %s', cache_key)
|
||||
return cache
|
||||
|
||||
use_cache = not len(kwargs.get('data', {})) > 0 and not kwargs.get('files')
|
||||
|
||||
if use_cache:
|
||||
cache_key_md5 = md5(cache_key)
|
||||
cache = Env.get('cache').get(cache_key_md5)
|
||||
if cache:
|
||||
if not Env.get('dev'): log.debug('Getting cache %s', cache_key)
|
||||
return cache
|
||||
|
||||
if url:
|
||||
try:
|
||||
@@ -259,7 +263,7 @@ class Plugin(object):
|
||||
del kwargs['cache_timeout']
|
||||
|
||||
data = self.urlopen(url, **kwargs)
|
||||
if data and cache_timeout > 0:
|
||||
if data and cache_timeout > 0 and use_cache:
|
||||
self.setCache(cache_key, data, timeout = cache_timeout)
|
||||
return data
|
||||
except:
|
||||
|
||||
@@ -64,7 +64,7 @@ class Provider(Plugin):
|
||||
|
||||
def getJsonData(self, url, decode_from = None, **kwargs):
|
||||
|
||||
cache_key = '%s%s' % (md5(url), md5('%s' % kwargs.get('params', {})))
|
||||
cache_key = md5(url)
|
||||
data = self.getCache(cache_key, url, **kwargs)
|
||||
|
||||
if data:
|
||||
@@ -81,7 +81,7 @@ class Provider(Plugin):
|
||||
|
||||
def getRSSData(self, url, item_path = 'channel/item', **kwargs):
|
||||
|
||||
cache_key = '%s%s' % (md5(url), md5('%s' % kwargs.get('params', {})))
|
||||
cache_key = md5(url)
|
||||
data = self.getCache(cache_key, url, **kwargs)
|
||||
|
||||
if data and len(data) > 0:
|
||||
|
||||
Reference in New Issue
Block a user