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

InMemoryStore expiration off by 1? #5

Open
pradtke opened this issue May 16, 2024 · 1 comment
Open

InMemoryStore expiration off by 1? #5

pradtke opened this issue May 16, 2024 · 1 comment

Comments

@pradtke
Copy link

pradtke commented May 16, 2024

In InMemoryStore (and my original version) we use

if (isset($item['expire']) && $item['expire'] < time()) {

for expiration check. I'm trying to fix some timing dependent tests in rate limiting and I found the rate limit tests assume that the store will expire the data on the expire time ( $item['expire'] <= time()) while the implementation of this store considers it valid on expire and expired 1 second later.

The phpdocs say int|null $expire – The expiration time (unix timestamp), or null if it never expires. which makes me think it should be considered expired on that time.

What do you think?

@tvdijen
Copy link
Member

tvdijen commented May 17, 2024

I've checked our other stores and they all follow the algorithm that if expire > now, the item is considered to be expired. So I think the logics are correct, but we need to clarify the phpdocs a bit more.

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

No branches or pull requests

2 participants