def has_heartbeat(self, user_id: str) -> bool: redis_key = RedisKeys.heartbeat_user(user_id) return self.redis.exists(redis_key)
def add_heartbeat(self, user_id: str) -> None: redis_key = RedisKeys.heartbeat_user(user_id) self.redis.set(redis_key, user_id) self.redis.expire(redis_key, ONE_MINUTE)