Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

cache:clear command deletes all cache pools #57064

Copy link
Copy link
Closed
@zing-james

Description

@zing-james
Issue body actions

Symfony version(s) affected

7.0.7

Description

The documentation and default config indicate that the cache:clear command uses the system clearer to clear the cache and that the app cache pools should persist between deployments. This does not happen under the default application configuration.

    # The "app" cache stores to the filesystem by default.
    # The data in this cache should persist between deploys.

How to reproduce

  • Create a new Symfony application
  • Add item to the app cache pool
  • Run bin/console cache:clear

Possible Solution

The issue seems to be related to the default configuration setting the kernel.build_dir = kernel.cache_dir.

These lines in Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand will overwrite the entire cache directory with the new build, effectively deleting all cache pools. Interestingly the --no-warmup option causes the pools to get cleared on a different line.

if ($this->isNfs($realBuildDir)) {
$io->note('For better performances, you should move the cache and log directories to a non-shared folder of the VM.');
$fs->remove($realBuildDir);
} else {
$fs->rename($realBuildDir, $oldBuildDir); // <-- loses app pools without --no-warmup
}

        $fs->rename($warmupDir, $realBuildDir); //<-- loses app pools with --no-warmup

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.