redis_interface: Added a few more wrapper functions (#82)

This commit is contained in:
Kartikeya Hegde
2022-12-07 18:34:30 +05:30
committed by GitHub
parent cd39dd4a99
commit 7313c06254

View File

@ -70,6 +70,18 @@ impl super::RedisConnectionPool {
.change_context(errors::RedisError::GetFailed)
}
#[instrument(level = "DEBUG", skip(self))]
pub async fn exists<V>(&self, key: &str) -> CustomResult<bool, errors::RedisError>
where
V: Into<MultipleKeys> + Unpin + Send + 'static,
{
self.pool
.exists(key)
.await
.into_report()
.change_context(errors::RedisError::GetFailed)
}
#[instrument(level = "DEBUG", skip(self))]
pub async fn get_and_deserialize_key<T>(
&self,
@ -149,6 +161,18 @@ impl super::RedisConnectionPool {
.change_context(errors::RedisError::SetExpiryFailed)
}
#[instrument(level = "DEBUG", skip(self))]
pub async fn set_expire_at(
&self,
key: &str,
timestamp: i64,
) -> CustomResult<(), errors::RedisError> {
self.pool
.expire_at(key, timestamp)
.await
.into_report()
.change_context(errors::RedisError::SetExpiryFailed)
}
#[instrument(level = "DEBUG", skip(self))]
pub async fn stream_append_entry<F>(
&self,