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

Fix plain GETEX wrongly removing expiration time #1548

Merged
merged 3 commits into from
Jul 7, 2023

Conversation

enjoy-binbin
Copy link
Member

The plain GETEX will remove the expiration time, since we
always do metadata.expire = expire and then write. In this
case, we will write expire = 0, causing the expiration time
to be erased.

Before:

127.0.0.1:6666> set foo bar ex 1000
OK
127.0.0.1:6666> ttl foo
(integer) 996
127.0.0.1:6666> getex foo
"bar"
127.0.0.1:6666> ttl foo
(integer) -1

After:

127.0.0.1:6666> set foo bar ex 1000
OK
127.0.0.1:6666> ttl foo
(integer) 998
127.0.0.1:6666> getex foo
"bar"
127.0.0.1:6666> ttl foo
(integer) 995

The plain GETEX will remove the expiration time, since we
always do `metadata.expire = expire` and then write. In this
case, we will write expire = 0, causing the expiration time
to be erased.

Before:
```
127.0.0.1:6666> set foo bar ex 1000
OK
127.0.0.1:6666> ttl foo
(integer) 996
127.0.0.1:6666> getex foo
"bar"
127.0.0.1:6666> ttl foo
(integer) -1
```

After:
```
127.0.0.1:6666> set foo bar ex 1000
OK
127.0.0.1:6666> ttl foo
(integer) 998
127.0.0.1:6666> getex foo
"bar"
127.0.0.1:6666> ttl foo
(integer) 995
```
@git-hulk git-hulk merged commit 7538810 into apache:unstable Jul 7, 2023
@enjoy-binbin enjoy-binbin deleted the getex_expire branch July 7, 2023 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants