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

Add an ability to disable expiration time randomization. #419

Open
beeyev opened this issue Mar 31, 2023 · 2 comments
Open

Add an ability to disable expiration time randomization. #419

beeyev opened this issue Mar 31, 2023 · 2 comments

Comments

@beeyev
Copy link

beeyev commented Mar 31, 2023

The library has this code to slightly change the expiration time.

$expirationDiff = rand(0, floor($cacheTime * .15));
$expiration -= $expirationDiff;

I know the reason, it's also discussed here.

Could you please add an ability to disable this feature when it's needed?
Developers should be able to set precise TTL when they really want to do that.

@tedivm
Copy link
Member

tedivm commented Mar 31, 2023

You can disable this at the Pool or Item level.

$pool->setInvalidationMethod(Stash\Invalidation::NONE)

This can be done on the item level as well. You may want to read through all the invalidation methods to see which one fits your needs most.

@tedivm tedivm closed this as completed Mar 31, 2023
@beeyev
Copy link
Author

beeyev commented Mar 31, 2023

I checked it, but this parameter does not change the behavior I mentioned.

Here

private function executeSet($data, $time)
    {
       ...

        // We need to be able to disable this part
        if ($cacheTime > 0) {
            $expirationDiff = rand(0, floor($cacheTime * .15));
            $expiration -= $expirationDiff;
        }

@tedivm tedivm reopened this Mar 31, 2023
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