1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-27 09:12:57 +01:00

chore: fix nightly warning

This commit is contained in:
Rob Ede 2024-06-20 02:28:58 +01:00
parent 52e58610e4
commit 032aeb6fdb
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933

View File

@ -159,13 +159,18 @@ impl SessionStore for RedisSessionStore {
let session_key = generate_session_key(); let session_key = generate_session_key();
let cache_key = (self.configuration.cache_keygen)(session_key.as_ref()); let cache_key = (self.configuration.cache_keygen)(session_key.as_ref());
self.execute_command(redis::cmd("SET").arg(&[ self.execute_command::<()>(
&cache_key, redis::cmd("SET")
&body, .arg(&[
"NX", // NX: only set the key if it does not already exist &cache_key, // key
"EX", // EX: set expiry &body, // value
&format!("{}", ttl.whole_seconds()), "NX", // only set the key if it does not already exist
])) "EX", // set expiry / TTL
])
.arg(
ttl.whole_seconds(), // EXpiry in seconds
),
)
.await .await
.map_err(Into::into) .map_err(Into::into)
.map_err(SaveError::Other)?; .map_err(SaveError::Other)?;
@ -223,14 +228,16 @@ impl SessionStore for RedisSessionStore {
self.client self.client
.clone() .clone()
.expire(&cache_key, ttl.whole_seconds()) .expire::<_, ()>(&cache_key, ttl.whole_seconds())
.await?; .await?;
Ok(()) Ok(())
} }
async fn delete(&self, session_key: &SessionKey) -> Result<(), anyhow::Error> { async fn delete(&self, session_key: &SessionKey) -> Result<(), anyhow::Error> {
let cache_key = (self.configuration.cache_keygen)(session_key.as_ref()); 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 .await
.map_err(Into::into) .map_err(Into::into)
.map_err(UpdateError::Other)?; .map_err(UpdateError::Other)?;