def save(self, courts: dict, courts_by_county: dict) -> bool: """ Persist the list of courts to local storage. Args: courts (dict): Dict of courts indexed by court id courts_by_county (dict): Dict where index is County and value is list of courts Returns: (bool): True if successful, otherwise False """ try: the_redis = DARedis() the_redis.set_data(STORE, cache_record(courts, courts_by_county)) return True except Exception as e: logmessage(f"Unable to cache list of courts: {str(e)}") return False
def save(self, case) -> bool: """ Save the revised case list. If a case is provided, then add it to the case list before saving. If no case is provided, then save the case list without doing anything else. (This is probably called by a delete operation.) Args: case (Case): Case to add to list or None Returns: (bool): True is successful save, otherwise raises exception. """ if case: key = case_key(case) case.key = key self.cases[key] = case the_redis = DARedis() the_redis.set_data(self.user_cases_key, self.cases) return True
def save(self, courts, clerks): """ Persist the directory info to file storage. """ the_redis = DARedis() the_redis.set_data(STORE, cache_record(courts, clerks))
def save_ls_fields(ls_variables, redis_secret, redis_key, expire=30): r = DARedis() encrypted_vars = encrypt_object(ls_variables, redis_secret) r.set_data(redis_key, encrypted_vars, expire=expire)
def save(self, counties): """ Persist the list of counties to file storage. """ the_redis = DARedis() the_redis.set_data(STORE, counties)
def save_me(about_me): the_redis = DARedis() key = ME_KEY.format(__user_id()) the_redis.set_data(key, about_me) return True
def del_cases(self): logmessage(f"del_cases(): " + "Deleting all cases for user = {self.user_id}") the_redis = DARedis() the_redis.set_data(self.user_cases_key, None) return