Skip to content
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

Refactor TTL processing in string type #2250

Merged
merged 5 commits into from
Apr 15, 2024

Conversation

PragmaTwice
Copy link
Member

@PragmaTwice PragmaTwice commented Apr 14, 2024

Previously, we use TTL as a parameter in string operations, and it's not good since we should use an absolute value in internal implementations to avoid double casting (EXAT timestamp -> cast to TTL -> cast back to expire timestamp, these introduce two GetTimestampMS() with probably different result).

Here we change TTL to timestamp as the parameter of string operations.

Close #2248.

Copy link

sonarcloud bot commented Apr 14, 2024

@@ -107,8 +103,7 @@ class CommandGetEx : public Commander {
}

private:
uint64_t ttl_ = 0;
bool persist_ = false;
std::optional<uint64_t> expire_;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we have a class wrapper to distinguish the syntax?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a interface with something like has_ttl() would look better, but feel free to just merge this

@PragmaTwice PragmaTwice merged commit aa7c745 into apache:unstable Apr 15, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: inappropriate type of ttl_ of CommandSet
3 participants