Skip to content

Commit

Permalink
fix(types): reset the value of expired key to prevent the following p…
Browse files Browse the repository at this point in the history
…arsing and calculation.
  • Loading branch information
FishYoung committed Nov 16, 2024
1 parent 185bfc6 commit b3a443c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/types/redis_string.cc
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ rocksdb::Status String::IncrBy(engine::Context &ctx, const std::string &user_key
if (!s.ok() && !s.IsNotFound()) return s;
if (s.IsNotFound()) {
Metadata metadata(kRedisString, false);
raw_value.clear();
metadata.Encode(&raw_value);
}

Expand Down Expand Up @@ -367,6 +368,7 @@ rocksdb::Status String::IncrByFloat(engine::Context &ctx, const std::string &use

if (s.IsNotFound()) {
Metadata metadata(kRedisString, false);
raw_value.clear();
metadata.Encode(&raw_value);
}
size_t offset = Metadata::GetOffsetAfterExpire(raw_value[0]);
Expand Down

0 comments on commit b3a443c

Please sign in to comment.