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

Try to cleanup cache entries with explicit ttl when apc.ttl is 0 #531

Merged

Conversation

madmajestro
Copy link
Contributor

If the runtime configuration setting apc.ttl is 0 (default value), the function apc_cache_default_expunge() always uses a real expunge and throws away tho whole cache content, even though this is unnecessary and not the documented behavior.

The documentation for apc.ttl says (see https://www.php.net/manual/en/apcu.configuration.php):
"... This setting has no effect on cache entries that have an explicit TTL specified."

The expected behavior is that entries with explicit TTL should be cleaned up first and only if this is insufficient a real expunge should be performed (independent of how apc.ttl is set).

Because apc_cache_entry_expired() takes care of the global apc.ttl setting, no special case is needed for apc.ttl == 0 in apc_cache_default_expunge(). For this reason the code in apc_cache_default_expunge() can be removed to solve the problem.

@nikic nikic merged commit 0415f0a into krakjoe:master Feb 21, 2025
31 checks passed
@madmajestro madmajestro deleted the cleanup-cache-entries-with-explicit-ttl branch February 24, 2025 10:53
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

Successfully merging this pull request may close these issues.

2 participants