Skip to content

Remove unnecessary string clones. #223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading