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

idea: reload cache when its about to expire in __destruct() #45

Open
Jimbolino opened this issue Feb 10, 2023 · 1 comment
Open

idea: reload cache when its about to expire in __destruct() #45

Jimbolino opened this issue Feb 10, 2023 · 1 comment

Comments

@Jimbolino
Copy link
Contributor

Currently when the cache is expired (every 15 sec), unleash needs to repopulate it.
In our case this causes a 200-300 ms delay on the total request.
Also on high traffic websites its possible that multiple users are making the same request at (almost) the same time.

I've tested with a simple mechanism that sets an "expires_at" timestamp, and a few seconds before the timestamp is reached it will refresh the cache with new data.
Because the refresh happens in the __destruct(), the user that triggers the refresh does not notice any delays.

Would you accept a PR for such a mechanism?

@mikefrancis
Copy link
Collaborator

@Jimbolino Sorry about the delay, feel free to submit a PR 👍

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