def cache_claim_check(block_id: str, claim_check: dict) -> None: """Cache a claim check in redis Args: block_id: the block id of the claim check that's being cached claim_check: the actual claim check to cache """ try: redis.hset_sync("broadcast:claimcheck", str(block_id), json.dumps(claim_check, separators=(",", ":"))) except Exception: _log.exception("Failure uploading claim to storage")
def save(self) -> None: """Save this event's state to redis""" _log.debug("Saving job params.") redis.hset_sync(JOB_PARAMS_KEY, self.id, self.as_json())
def register_callback(txn_id: str, callback_url: str) -> None: """Registers a the calling-back of a specific url once processing of a txn is complete""" redis.hset_sync(CALLBACK_REDIS_KEY, txn_id, callback_url)
def test_hset(self): redis.hset_sync("banana", "banana", "banana") redis.redis_client.hset.assert_called_once_with("banana", "banana", "banana")