mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 17:47:54 +08:00
redis_interface: Added a few more wrapper functions (#82)
This commit is contained in:
@ -70,6 +70,18 @@ impl super::RedisConnectionPool {
|
|||||||
.change_context(errors::RedisError::GetFailed)
|
.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))]
|
#[instrument(level = "DEBUG", skip(self))]
|
||||||
pub async fn get_and_deserialize_key<T>(
|
pub async fn get_and_deserialize_key<T>(
|
||||||
&self,
|
&self,
|
||||||
@ -149,6 +161,18 @@ impl super::RedisConnectionPool {
|
|||||||
.change_context(errors::RedisError::SetExpiryFailed)
|
.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))]
|
#[instrument(level = "DEBUG", skip(self))]
|
||||||
pub async fn stream_append_entry<F>(
|
pub async fn stream_append_entry<F>(
|
||||||
&self,
|
&self,
|
||||||
|
|||||||
Reference in New Issue
Block a user