magento-cache-clean icon indicating copy to clipboard operation
magento-cache-clean copied to clipboard

Handling custom configuration files

Open mvenghaus opened this issue 3 years ago • 2 comments

Hey Vinai,

I have some custom configuration files and I want your tool to handle them without rebuilding the source.

A rules config file would be nice .. maybe something simple like that: vendor/bin/cache-clean.js -w --custom-rules=rules.json

{
  "/etc/custom\\.xml$": ["config", "block_html"]
}

Or is it already possible?

Regards Marcus

mvenghaus avatar May 09 '21 04:05 mvenghaus

Hi, thanks for opening the issue! This is something I've been thinking about, too. So far I haven't had to cache my custom configuration files, but it certainly is a use case.

My idea was to allow a file called etc/cache-clean-rules.json (or maybe .edn or .js) to be added to modules. In this file it would be possible to declare three types of mappings:

1.) file name regex to cache types (as in your example) 2.) file name regex to cache IDs 3.) file name regex to a callback that returns the cache IDs to clean for a given file

The underlying idea is to keep cache cleans granular so full config cache cleans can be avoided if possible. Do you have any thoughts on this?

Vinai avatar May 10 '21 08:05 Vinai

Hi,

that sounds like a plan .. I'm in :)

  1. Would be the affected file a parameter in that case?

mvenghaus avatar May 11 '21 13:05 mvenghaus