Fixing a bug about caching paste inside Redis :)

This commit is contained in:
Starow 2014-08-08 17:23:51 +02:00
parent 7a1db94f9e
commit eb603e8762

View file

@ -94,11 +94,11 @@ class Paste(object):
""" """
r_serv = self.cache r_serv = self.cache
if r_serv.exists(self.p_path): paste = r_serv.get(self.p_path)
paste = r_serv.get(self.p_path) if paste is None:
else:
with gzip.open(self.p_path, 'rb') as F: with gzip.open(self.p_path, 'rb') as F:
paste = r_serv.getset(self.p_path, F.read()) paste = F.read()
r_serv.set(self.p_path, paste)
r_serv.expire(self.p_path, 300) r_serv.expire(self.p_path, 300)
return paste return paste