Command line method for cache control

Is there a command line method to manage cache settings? I see that I can clear the cache with “concrete c5:clear-cache”, but I would like to enable/disable various cache settings via the command line.

You can control the cache settings by using the c5:config CLI command.

If you want to let users update the configuration values via the dashboard interface, you have to use the -g option: if you don’t specify it, the changes performed via the dashboard won’t be applied.

So, for example, to turn on blocks output cache, you have to run this command:

./concrete/bin/concrete c5:config set -g concrete.cache.blocks true

(if you use concrete5 v8 you have to use ./concrete/bin/concrete5 instead of ./concrete/bin/concrete).

To determine the full list of configuration keys, you can check the the source code of the cache dashboard page:

  • in the view file you can see the variable name associated to the configuration you need (for example, for Block Output Cache it’s $enableBlockCache)
  • in the controller file you can retrieve the configuration keys used to assign the variables used in the view (for example, for enableBlockCache it’s concrete.cache.blocks)