{"id":30379111,"url":"https://github.com/mage-os/magento-cache-clean","last_synced_at":"2025-08-20T19:05:10.164Z","repository":{"id":302455953,"uuid":"1012492150","full_name":"mage-os/magento-cache-clean","owner":"mage-os","description":"A faster drop in replacement for bin/magento cache:clean with file watcher","archived":false,"fork":false,"pushed_at":"2025-07-15T14:14:15.000Z","size":4658,"stargazers_count":26,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-19T06:49:18.844Z","etag":null,"topics":["adobecommerce","cache-manager","dev-utility","mage-os","magento","magento2"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mage-os.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"vinai"}},"created_at":"2025-07-02T12:16:35.000Z","updated_at":"2025-08-17T11:14:44.000Z","dependencies_parsed_at":"2025-07-02T13:51:28.698Z","dependency_job_id":"4b2d40c0-380d-4b78-87e4-a96846f46fe3","html_url":"https://github.com/mage-os/magento-cache-clean","commit_stats":null,"previous_names":["mage-os/magento-cache-clean"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/mage-os/magento-cache-clean","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mage-os%2Fmagento-cache-clean","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mage-os%2Fmagento-cache-clean/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mage-os%2Fmagento-cache-clean/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mage-os%2Fmagento-cache-clean/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mage-os","download_url":"https://codeload.github.com/mage-os/magento-cache-clean/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mage-os%2Fmagento-cache-clean/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271369550,"owners_count":24747795,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adobecommerce","cache-manager","dev-utility","mage-os","magento","magento2"],"created_at":"2025-08-20T19:04:09.008Z","updated_at":"2025-08-20T19:05:10.133Z","avatar_url":"https://github.com/mage-os.png","language":"Clojure","funding_links":["https://github.com/sponsors/vinai"],"categories":["Open Source Extensions"],"sub_categories":["Infrastructure"],"readme":"\u003e \"You know, hope is a mistake. If you can't fix what's broken, you'll, uh... you'll go insane.\" - Max Rockatansky\n\n# Magento 2 Cache Clean\n\nA faster drop in replacement for `bin/magento cache:clean` with a file watcher.\n\nThe file watcher automatically cleans affected cache types in the Magento 2 cache during development.\nFor example, if you make a change to a template, it only cleans the\n`block_html` and `full_page` caches, not the `config` or `layout` caches.\n\nThe project is only tested on MacOS and Linux.\nPlease report bugs by opening an issue on the [GitHub issue tracker](https://github.com/mage-os/magento-cache-clean/issues).\n\n## Features\n\n* Supports file, redis and varnish cache backends\n* Removes affected generated code classes when a source file is changed\n* Zero configuration, all required information is read from `app/etc/env.php`\n* Hotkeys for quick cache flushes while the watcher is running\n\n\n## Installation \u0026 Updating\n\nInstallation:\n\n``` shell\ncomposer require --dev mage-os/magento-cache-clean\n```\n\nUpdate:\n\n``` shell\ncomposer update --dev mage-os/magento-cache-clean\n```\n\nThe tool is commonly installed globally using `composer global require ...`.\n\n\n## Usage\n\nIn your Magento directory, run `vendor/bin/cache-clean.js --watch`\n\nPress `Ctrl-C` to exit the watcher process.\n\nThe script can also be used as a faster drop in replacement of `bin/magento cache:clean`.\nFor example:\n\n``` shell\nvendor/bin/cache-clean.js config full_page\n```\n(It's quicker because the start-up time of `bin/magento` is so slow.)\n\nThere are several options to customize the behavior:\n\n```\nvendor/bin/cache-clean.js --help\n\nUsage: cache-clean.js [options and flags] [cache-types...]\nClean the given cache types. If none are given, clean all cache types.\n\n--directory|-d \u003cdir\u003e    Magento base directory\n--watch|-w              Watch for file changes\n--verbose|-v            Display more information\n--no-flood-guard|-n     Disable the 5s debounce per cache type\n--debug|-vv             Display too much information\n--silent|-s             Display less information\n--keep-generated|-k     Do not modify generated/code/\n--file-list|-f \u003cfile\u003e   Process file list and exit\n--version               Display the version\n--help|-h               This help message\n```\n\nUsually I run the command once with the `--watch` switch (or `-w`) when I start development, and when I make a change\nthat isn't automatically detected (yet), I run `vendor/bin/cache-clean.js` with the given cache types as a drop in\nreplacement for `bin/magento cache:clean`.\n\n### Hotkeys\n\nWhen the watcher is running, segments of the cache can be cleaned with\nindividual keystrokes:\n\n|Key|Cache Segment(s)|\n|---|----------------|\n|`c`| `config` |\n|`b`| `block_html` |\n|`l`| `layout` |\n|`f`| `full_page` |\n|`a`| (a for all) |\n|`v`| (v for view) `block_html`, `layout`, `full_page`, `translate` |\n|`t`| `translate` |\n\nThere also are hotkeys to clean the static assets in the `A`dminhtml or\nthe `F`rontend area or `I`ntegration test sandboxes or clean the `G`enerated code directory.\n\n## Clearing cache on production after deploy\n\nThe `--file-list \u003cfile\u003e` argument is intended to be used to flush affected caches after deployment.  \nList the names of all changed files separated by a newline in the specified file.  \nUse the `--keep-generated` switch if you want files in `generated/code` to remain even if the PHP source files changed.\n\n### Prerequisites:\n\n* `node.js` (built on 18, but should work with older 10.x versions, too).\n* It's a good idea to turn on all Magento caches `bin/magento cache:enable` to get the full benefit.\n\n\n## Known issues\n\n* Currently, the watcher has to be restarted after a new theme is added, so it\n  is added to the watchlist.\n\n* Changes to files on NFS mounts (e.g. in vagrant) do **not** trigger the watches.\n  Depending on a given setup, it might be possible to run the watcher on the\n  host system instead.\n\n* If you run the task in PHPStorm and the hotkeys are not working, search for\n  actions by pressing `STRG+SHIFT+A`, then search for \"registry...\", then\n  enable `nodejs.console.use.terminal` and restart the watcher process.\n\n* Not tested a lot on Windows, please open an issue if you want to contribute.\n\n* If you run into the error `Error NOSPC` or `ENOSPC: System limit for number of file watchers reached` on Linux, run the command:\n\n``` shell\necho fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf \u0026\u0026 sudo sysctl -p\n```\n\n* In Magento 2.1.0 - 2.3.3 there is a [bug](https://github.com/magento/magento2/pull/22228) that causes the full page cache\n  records to be written to the `var/cache` directory instead of `var/page_cache`.\n  This issue causes the cache cleaner behavior to be erratic.\n  There is an easy workaround, namely removing all cache configuration from\n  the default `app/etc/env.php`. The bug only affects the default config with the\n  file system cache backend. Redis or Varnish are not affected.\n  The bug will be fixed in the (currently upcoming) Magento 2.3.4 release.\n\n\n## More information\n\n* Some words on using the watcher with [Docker \u0026 VMs](https://github.com/mage-os/magento-cache-clean/blob/main/doc/docker-and-vm.md).\n\n* [Running the watcher from code](https://github.com/mage-os/magento-cache-clean/blob/main/doc/using-via-code.md).\n\n* The [rationale](https://github.com/mage-os/magento-cache-clean/blob/main/doc/rationale.md) explains the reasons I wrote the utility.\n\n* How to [build](https://github.com/mage-os/magento-cache-clean/blob/main/doc/building.md) the tool from source.\n\n* This package used to be called `mage2tv/magento-cache-clean`, but now it is part of Mage-OS, and thus the package name \n  is `mage-os/magento-cache-clean`. The original package still works as it now is an empty wrapper that requires this \n  package. Existing installations should continue to work.\n\n## Thanks\n\nThis script was inspired by [Timon de Groot](https://twitter.com/TimonGreat)'s\n[blog post](https://blog.timpack.org/speed-up-magento-development) where he describes the idea to use a file watcher in\nPHPStorm to call `redis-cli` to clear the complete cache whenever a XML file is modified.\nThe only downside of that solution is that it always flushes the full cache and only works with redis.\n\nThank you also to everybody who gave feedback, shared ideas and helped test new features! This tool would be impossible\nwithout you!\n\n## Copyright \u0026 License\n\nCopyright 2019 - present by Vinai Kopp, distributed under the BSD-3-Clause license (see\nthe [LICENSE](https://github.com/mage-os/magento-cache-clean/blob/main/LICENSE) file).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmage-os%2Fmagento-cache-clean","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmage-os%2Fmagento-cache-clean","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmage-os%2Fmagento-cache-clean/lists"}