diff --git a/actix-session/src/storage/redis_rs.rs b/actix-session/src/storage/redis_rs.rs index 34f24d655..3dafbc650 100644 --- a/actix-session/src/storage/redis_rs.rs +++ b/actix-session/src/storage/redis_rs.rs @@ -159,13 +159,18 @@ impl SessionStore for RedisSessionStore { let session_key = generate_session_key(); let cache_key = (self.configuration.cache_keygen)(session_key.as_ref()); - self.execute_command(redis::cmd("SET").arg(&[ - &cache_key, - &body, - "NX", // NX: only set the key if it does not already exist - "EX", // EX: set expiry - &format!("{}", ttl.whole_seconds()), - ])) + self.execute_command::<()>( + redis::cmd("SET") + .arg(&[ + &cache_key, // key + &body, // value + "NX", // only set the key if it does not already exist + "EX", // set expiry / TTL + ]) + .arg( + ttl.whole_seconds(), // EXpiry in seconds + ), + ) .await .map_err(Into::into) .map_err(SaveError::Other)?; @@ -223,14 +228,16 @@ impl SessionStore for RedisSessionStore { self.client .clone() - .expire(&cache_key, ttl.whole_seconds()) + .expire::<_, ()>(&cache_key, ttl.whole_seconds()) .await?; + Ok(()) } async fn delete(&self, session_key: &SessionKey) -> Result<(), anyhow::Error> { let cache_key = (self.configuration.cache_keygen)(session_key.as_ref()); - self.execute_command(redis::cmd("DEL").arg(&[&cache_key])) + + self.execute_command::<()>(redis::cmd("DEL").arg(&[&cache_key])) .await .map_err(Into::into) .map_err(UpdateError::Other)?;