mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 09:38:33 +08:00
fix: Use hsetnx for setting ephemeral key (#278)
This commit is contained in:
@ -246,6 +246,25 @@ impl super::RedisConnectionPool {
|
||||
.await
|
||||
}
|
||||
|
||||
#[instrument(level = "DEBUG", skip(self))]
|
||||
pub async fn serialize_and_set_multiple_hash_field_if_not_exist<V>(
|
||||
&self,
|
||||
kv: &[(&str, V)],
|
||||
field: &str,
|
||||
) -> CustomResult<Vec<HsetnxReply>, errors::RedisError>
|
||||
where
|
||||
V: serde::Serialize + Debug,
|
||||
{
|
||||
let mut hsetnx: Vec<HsetnxReply> = Vec::with_capacity(kv.len());
|
||||
for (key, val) in kv {
|
||||
hsetnx.push(
|
||||
self.serialize_and_set_hash_field_if_not_exist(key, field, val)
|
||||
.await?,
|
||||
);
|
||||
}
|
||||
Ok(hsetnx)
|
||||
}
|
||||
|
||||
#[instrument(level = "DEBUG", skip(self))]
|
||||
pub async fn hscan(
|
||||
&self,
|
||||
|
||||
Reference in New Issue
Block a user