[cache] fix

This commit is contained in:
Rushabh Mehta 2015-05-08 22:30:38 +05:30
parent ad100e3054
commit 4e6b6ebdb9
3 changed files with 5 additions and 3 deletions

View file

@ -166,7 +166,7 @@ def get_defaults_for(parent="__default"):
elif d.defvalue is not None:
defaults[d.defkey] = d.defvalue
frappe.cache().hset("default", parent, defaults)
frappe.cache().hset("defaults", parent, defaults)
return defaults

View file

@ -17,7 +17,9 @@ def get_notifications():
notification_count = {}
for name in groups:
notification_count[name] = cache.hget("notification_count:" + name, frappe.session.user)
count = cache.hget("notification_count:" + name, frappe.session.user)
if count is not None:
notification_count[name] = count
return {
"open_count_doctype": get_notifications_for_doctypes(config, notification_count),
@ -81,7 +83,6 @@ def get_notifications_for_doctypes(config, notification_count):
else:
open_count_doctype[d] = result
frappe.cache().hset("notification_count:" + d, frappe.session.user, result)
return open_count_doctype

View file

@ -109,6 +109,7 @@ class RedisWrapper(redis.Redis):
value = super(redis.Redis, self).hget(self.make_key(name), key)
if value:
value = pickle.loads(value)
frappe.local.cache[name][key] = value
elif generator:
value = generator()
self.hset(name, key, value)