All Projects → mage2tv → Magento Cache Clean

mage2tv / Magento Cache Clean

Licence: bsd-3-clause
A faster drop in replacement for bin/magento cache:clean with file watcher

Programming Languages

clojure
4091 projects

Labels

Projects that are alternatives of or similar to Magento Cache Clean

Magento-Quickorder
Magento Quickorder module, enables bulk order creation by inputting SKUs & quantities.
Stars: ✭ 30 (-91.8%)
Mutual labels:  magento2
magento2-webappmanifest
A Magento 2 extension that adds a Web App Manifest to the store.
Stars: ✭ 19 (-94.81%)
Mutual labels:  magento2
Magento2 Phpstorm Plugin
PHPStorm Plugin for Magento 2
Stars: ✭ 294 (-19.67%)
Mutual labels:  magento2
magento-2-layered-navigation
Magento 2 Layered Navigation extension Free optimizes the navigation process, redirects users to product catalog pages, and makes finding products easier
Stars: ✭ 16 (-95.63%)
Mutual labels:  magento2
m2.Breadcrumbs
Magento2. Extension add breadcrumbs to pages in Magento2 that by default do not have breadcrumbs.
Stars: ✭ 17 (-95.36%)
Mutual labels:  magento2
Magento2Msp
MultiSafepay plugin for Magento 2 (Deprecated) see: https://github.com/MultiSafepay/magento2
Stars: ✭ 29 (-92.08%)
Mutual labels:  magento2
module-checkout-designs
Allow multiple options for Magento 2 checkout layout. Provides capabilities to AB test checkout changes and more.
Stars: ✭ 28 (-92.35%)
Mutual labels:  magento2
Magento2 Regenerate url rewrites
Magento 2 extension which add feature of regenerating a url rewrites of products/categories
Stars: ✭ 310 (-15.3%)
Mutual labels:  magento2
module-url-rewrite-optimiser
A Magento module that stops URL rewrites with category paths being generated for products when 'Use Categories Path for Product URLs' setting is disabled in config.
Stars: ✭ 37 (-89.89%)
Mutual labels:  magento2
Cleancheckout
A drop-in replacement for the Magento 2 checkout.
Stars: ✭ 280 (-23.5%)
Mutual labels:  magento2
magento2-module-ordergrid
The Order Grid module adds more details to the order grid in the admin.
Stars: ✭ 54 (-85.25%)
Mutual labels:  magento2
magento2-product-grid-category-filter
Add category column and filter in an efficient way to the product grid in the Magento 2 admin.
Stars: ✭ 22 (-93.99%)
Mutual labels:  magento2
Inventory
Magento Inventory Project (a.k.a MSI)
Stars: ✭ 270 (-26.23%)
Mutual labels:  magento2
MultipleLayeredNavigation-M2
Magento 2 Multiple Layered Navigation extension.
Stars: ✭ 20 (-94.54%)
Mutual labels:  magento2
React Storefront
React Storefront - PWA for eCommerce. 100% offline, platform agnostic, headless, Magento 2 supported. Always Open Source, Apache-2.0 license. Join us as contributor ([email protected]).
Stars: ✭ 292 (-20.22%)
Mutual labels:  magento2
how-to-venia
Magento PWA Storefront based on PWA Studio's Venia Storefront (Concept)
Stars: ✭ 39 (-89.34%)
Mutual labels:  magento2
installer-m2
Universal extension installer for Magento 2, see introductory blog post here
Stars: ✭ 27 (-92.62%)
Mutual labels:  magento2
Docker Magento2
Docker image for Magento 2
Stars: ✭ 336 (-8.2%)
Mutual labels:  magento2
Magento2 Developer Quickdevbar
Developer Toolbar for Magento2
Stars: ✭ 306 (-16.39%)
Mutual labels:  magento2
React Storefront
Build and deploy e-commerce progressive web apps (PWAs) in record time.
Stars: ✭ 275 (-24.86%)
Mutual labels:  magento2

"You know, hope is a mistake. If you can't fix what's broken, you'll, uh... you'll go insane." - Max Rockatansky

Magento 2 Cache Clean

A faster drop in replacement for bin/magento cache:clean with a file watcher.

The file watcher automatically cleans affected cache types in the Magento 2 cache during development. For example, if you make a change to a template, it only cleans the block_html and full_page caches, not the config or layout caches.

The project is only tested on MacOS and Linux. Please report bugs by opening an issue on the GitHub issue tracker.

Features

  • Supports file, redis and varnish cache backends
  • Removes affected generated code classes when a source file is changed
  • Zero configuration, all required information is read from app/etc/env.php
  • Hotkeys for quick cache flushes while the watcher is running

Installation & Updating

Installation:

composer require --dev mage2tv/magento-cache-clean

Update:

composer remove --dev mage2tv/magento-cache-clean
composer require --dev mage2tv/magento-cache-clean

The tool is commonly installed globally using composer global require ....

Usage

In your Magento directory, run vendor/bin/cache-clean.js --watch

Press Ctrl-C to exit the watcher process.

The script can also be used as a faster drop in replacement of bin/magento cache:clean. For example:

vendor/bin/cache-clean.js config full_page

(It's quicker because the start up time of bin/magento is so slow.)

There are several options to customize the behavior:

vendor/bin/cache-clean.js --help
Sponsored by https://www.mage2.tv

Usage: cache-clean.js [options and flags] [cache-types...]
Clean the given cache types. If none are given, clean all cache types.

--directory|-d <dir>    Magento base directory
--watch|-w              Watch for file changes
--verbose|-v            Display more information
--debug|-vv             Display too much information
--silent|-s             Display less information
--version               Display the version
--help|-h               This help message

Usually I run the command once with the --watch switch when I start development, and when I make a change that isn't automatically detected (yet), I run vendor/bin/cache-clean.js with the given cache types as a drop in replacement for bin/magento cache:clean.

Hotkeys

When the watcher is running, segments of the cache can be cleaned with individual keystrokes:

Key Cache Segment(s)
c config
b block_html
l layout
f full_page
a (a for all)
v (v for view) block_html, layout, full_page
t translate

There also are hotkeys to clean the static assets in the Adminhtml or the Frontend area or clean the Generated code directory.

Prerequisites:

  • node.js (built on 10.8, but should work with older 8.x versions, too).
  • It probably is a good idea to turn on all Magento caches bin/magento cache:enable to get the full benefit.

Known issues

  • Currently the watcher has to be restarted after a new theme is added so it is added to the watchlist.

  • Changes to files on NFS mounts (e.g. in vagrant) do not trigger the watches. Depending on a given setup, it might be possible to run the watcher on the host system instead.

  • If you run the task in PHPStorm and the hotkeys are not working, search for actions by pressing STRG+SHIFT+A, then search for "registry...", then enable nodejs.console.use.terminal and restart the watcher process.

  • Not tested a lot on Windows, please open an issue if you want to contribute.

  • If you run into the error Error NOSPC or ENOSPC: System limit for number of file watchers reached on Linux, run the command:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
  • Since Magento 2.1 there is a bug that causes the full page cache records to be written to the var/cache directory instead of var/page_cache. This issue causes the cache cleaner behavior to be erratic. There is an easy workaround, namely removing all cache configuration from the default app/etc/env.php. The bug only affects the default config with the file system cache backend. Redis or Varnish are not affected. The bug will be fixed in the (currently upcoming) Magento 2.3.4 release.

More information

Thanks

Thanks to Mage2 TV for sponsoring the development of this tool.

This script was inspired by Timon de Groot's blog post where he describes the idea to use a file watcher in PHPStorm to call redis-cli to clear the complete cache whenever a XML file is modified. The only downside of that solution is that it always flushes the full cache and only works with redis.

Thank you also to everybody who gave feedback, shared ideas and helped test new features! This tool would be impossible without you!

Copyright & License

Copyright 2019 by Vinai Kopp, distributed under the BSD-3-Clause license (see the LICENSE file).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].