Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

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

@Jimbolino

Description

@Jimbolino

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions