1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-23 15:51:06 +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 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)?;