Skip to content

[Cache] Apcu adapter in CLI #36399

Closed
Closed
@ossinkine

Description

@ossinkine

Description

APCu cache adapter works when apc.enabled is on, however, in CLI mode with the apc.enable_cli turned off, the adapter generates a lot of messages like Failed to save key.
For the system cache, this was fixed in #23390 by installing NullLogger in the adapter.
However, the problem persists for example in this configuration:

framework:
    cache:
        pools:
            cache.default:
                adapters:
                    - cache.adapter.apcu
                    - cache.adapter.redis

I suggest checking the apc.enable_cli option in each method, and do nothing in CLI mode, don't try to call acpu functions.
Something like this:

protected function doFetch(array $ids)
{
    if ('cli' === \PHP_SAPI && !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) {
        return [];
    }

    ...
}

If this is a good solution, I will create a PR. If not, what decision do you think would be good?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions