You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "git-hulk (via GitHub)" <gi...@apache.org> on 2023/09/06 12:16:22 UTC

[GitHub] [kvrocks] git-hulk commented on a diff in pull request #1743: Fix `GETEX` not working correctly on `Redis::Bitmap`

git-hulk commented on code in PR #1743:
URL: https://github.com/apache/kvrocks/pull/1743#discussion_r1317190752


##########
src/commands/cmd_string.cc:
##########
@@ -86,6 +86,8 @@ class CommandGetEx : public Commander {
       uint32_t max_btos_size = static_cast<uint32_t>(config->max_bitmap_to_string_mb) * MiB;
       redis::Bitmap bitmap_db(svr->storage, conn->GetNamespace());
       s = bitmap_db.GetString(args_[1], max_btos_size, &value);
+      if (ttl_ > 0) bitmap_db.Expire(args_[1], ttl_ + util::GetTimeStampMS());
+      if (persist_) bitmap_db.Expire(args_[1], 0);

Review Comment:
   It would be more consistent to use `if..else if` since it's exclusive between TTL and PERSIST.
   ```suggestion
         if (ttl_ > 0) {
           bitmap_db.Expire(args_[1], ttl_ + util::GetTimeStampMS());
         } else if (persist_) {
           bitmap_db.Expire(args_[1], 0);
         }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org