def cache_activities_doc(self, gid, activities_doc): """ stores activities document (google's) into local database (redis) @param gid: source user id @param activities_doc: source data dict """ self.rc.hset(S1.cache_key(gid), S1.cache_items_key(), json.dumps(activities_doc, encoding='utf-8'))
def get_activities(self, gid): str_value = self.rc.hget(S1.cache_key(gid), S1.cache_items_key()) return json.loads(str_value) if str_value else None