Skip to content

Commit

Permalink
Merge pull request #223 from nihohit/redis-improvements
Browse files Browse the repository at this point in the history
Remove unnecessary string clones.
  • Loading branch information
jaemk authored Nov 6, 2024
2 parents 0bd99d7 + 6d10e80 commit ff7d875
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/stores/redis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ where
let mut pipe = redis::pipe();
let key = self.generate_key(key);

pipe.get(key.clone());
pipe.get(&key);
if self.refresh {
pipe.expire(key, self.seconds as i64).ignore();
}
Expand All @@ -295,7 +295,7 @@ where
let key = self.generate_key(&key);

let val = CachedRedisValue::new(val);
pipe.get(key.clone());
pipe.get(&key);
pipe.set_ex::<String, String>(
key,
serde_json::to_string(&val)
Expand Down Expand Up @@ -324,7 +324,7 @@ where
let mut pipe = redis::pipe();
let key = self.generate_key(key);

pipe.get(key.clone());
pipe.get(&key);
pipe.del::<String>(key).ignore();
let res: (Option<String>,) = pipe.query(&mut *conn)?;
match res.0 {
Expand Down Expand Up @@ -553,7 +553,7 @@ mod async_redis {
let mut pipe = redis::pipe();
let key = self.generate_key(key);

pipe.get(key.clone());
pipe.get(&key);
if self.refresh {
pipe.expire(key, self.seconds as i64).ignore();
}
Expand All @@ -579,7 +579,7 @@ mod async_redis {
let key = self.generate_key(&key);

let val = CachedRedisValue::new(val);
pipe.get(key.clone());
pipe.get(&key);
pipe.set_ex::<String, String>(
key,
serde_json::to_string(&val)
Expand Down Expand Up @@ -609,7 +609,7 @@ mod async_redis {
let mut pipe = redis::pipe();
let key = self.generate_key(key);

pipe.get(key.clone());
pipe.get(&key);
pipe.del::<String>(key).ignore();
let res: (Option<String>,) = pipe.query_async(&mut conn).await?;
match res.0 {
Expand Down

0 comments on commit ff7d875

Please sign in to comment.