Download the PHP package wubinworks/module-cache-warmer without Composer

On this page you can find all versions of the php package wubinworks/module-cache-warmer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package module-cache-warmer

Magento 2 Free Sitemap Based Cache Warmer Extension

A Free Magento 2 Extension designed for CDN and Varnish cache warming. Warm up URLs located in sitemaps, as well as static content, media content and dynamic catalog images. Run manually or schedule by cron expression. This extension is easily customizable with dispatched events and the CLI command is ready to be embedded in deployment scripts.

Magento 2 Free Sitemap Based Cache Warmer Extension

Introduction

Magento 2 comes with Full Page Cache out-of-the-box. Users can choose "Built-in Cache", "Varnish Cache" or "CDN"(requires installing the CDN's free extension).
However, no matter which caching application is employed, Magento 2 still lacks the ability to let the caching application serve "Warm Cache". In other words, a web page feels slow when it is visited the first time. The reason is at that time, the CDN didn't have the warm cache yet.
Adobe Commerce Cloud does have a Post-deploy cache warming environment configuration, but it is not a Magento extension and not user friendly. It only offers limited features. For example, it can neither warm up static content nor keep the populated cache warmed.

The goal of this extension is to become an ultimate solution to suit the needs of cache warming for a Magento store. It focuses on real-world business use cases by covering automation in mind.

Feature Highlights

Why Sitemap Based?

Instead of retrieving URLs from the standard "3 content types" (i.e., product, category and CMS) internally, it is more practical to extract URLs from sitemaps. In this way, content types introduced by third-party extensions such as blog posts, product tags are covered as well. Any custom content which includes itself into the sitemap can be warmed up.
In addition, our design gives the user more freedom and flexibility. The user can specify multiple sitemaps as automatically generated by Magento's built-in feature and/or managed by external tools. The user can even use gzipped sitemap.

Why URL List?

A URL list is simply a text file containing line separated URLs. For most systems, generating such a file is extremely straightforward.

A typical use case is when the store has like more than 10,000 products. Warming up the entire store will cost a huge amount of resource and time. The recommended way is to pick some products from the entire store by the user's own criteria and then put their URLs in a txt file to feed the Cache Warmer.
To be more specific, for example, the user can export products from the "Top Sellers" category to a CSV file and get their url_keys to build full URLs. Then the user saves those URLs to a top-sellers.txt file which will be used as a Sitemap URI.

Supported Sitemap Formats

Sitemap URI

Security Warning

The "Sitemap" can be on local or remote servers and acts as a "user input".
It is the user's responsibility to make sure the content of the sitemap is controlled only by the user.

Supported Schemes

Supported Sitemap Formats

Sitemap URI Example

URL List Example

A .txt file with content like:

Static and Media Content

The Cache Warmer scans pub/static and pub/media directories and build all URLs for those files.

File Exclusion

Static Content

Dynamic Catalog Images

Requirements

Magento 2.4.2 introduced a new feature -- Image optimization based on query parameters for catalog images.

Configuration Location

This feature can let product use Dynamic URLs with resizing parameters.

Dynamic Product Image URL Example

The Cache Warmer is capable of "calculating" all of those URLs.

Important Notes

This content type will be automatically disabled at runtime if the Magento version does not meet the requirements or the above configuration is not set to "Image optimization based on query parameters".

Images of disabled products are excluded.

CDN Caching Behavior

Cache Lifetime

The cache warming is not a "one-time job", CDN cache has lifetime. They have a TTL(Time-To-Live) configuration, but this configuration is usually used as a fallback. In most cases, the TTL is informed by HTTP response headers which can be controlled by the web application(i.e., Magento).

However, somemany CDNs do not "respect" the specified TTL. According to their documentation, less popular content will be removed before its TTL expires and this is an expected behavior.
For example, we observed that on Fastly, if a web page is not accessed for 2 hours, it will be removed from their cache even the TTL is 1 day.

To keep the populated cache warmed, adjust the "Frequency" configuration properly.

Maximum Cacheable File Size Limit

CDNs always have a maximum cacheable file size limit. This limit can be found in their documentations and varies from CDN to CDN, plan to plan. Files larger than this limit cannot be cached by CDN, hence there is no need to warm up those files.

To exclude those large files, set the "Maximum File Size" value properly.

How Long Does The Process Take?

This extension already makes use of simultaneous requests to speed up the cache warming process.

The time it takes mainly depends on how many products the store has and the web server's performance. If the store has a lot of blog posts, CMS pages, this will become an affecting factor as well.

In our test case, the process takes around 20 ~ 40 minutes to finish for a store having around 1000 products and concurrency set to 25.

Bonus Feature

Output failed URLs collected from the cache warming process with Error Codes to a CSV file

This feature demonstrates how to customize this extension by utilizing its dispatched events.
The Error Codes can help diagnose problems, especially problems in sitemaps.

Error Codes

Code Explanation Typical Causes
-30 Unknown internal HTTP client error Extension or its dependencies' bug[1]
-20 Invalid internal HTTP client option error Customization bug
-10 Unknown error
10 Connection error
  • Connection timeout[2]
  • Server refused connection
20 Invalid request or response error Request
  • Domain name unresolvable[2]
  • Malformed URL input
Response
  • Response size is too large(Check internal HTTP client configuration)
30 3XX redirect loop error
  • Incorrect web server configuration
  • Incorrect URL Rewrite configuration
>=100 HTTP status code
  1. Negative error codes should not occur. Negative error code indicates there is probably a bug in this extension or its dependencies or its customization.

  2. The cause can be on the HTTP proxy server side. For example:
    • The connection timeout may be caused by an incorrect HTTP proxy server address
    • The HTTP proxy server may not be able to resolve domain name

If you saw negative error codes but did not customize this extension, please report the error to improve this extension.

Command Line Usage

This command is designed for "Run Manually".

ww:cache-warmer:run can be shorten to ww:cw:run.

--try-number is optional and for debug purpose only. It limits how many URLs will be picked out from each "Content Type". This option can be used to perform a quick test of sitemaps and configurations.

Deployment Automation

It is a good practice to place the command in deployment scripts.
Once the extension is properly configured, you can forget about it and the CDN cache will stay warm constantly.

HTTP Proxy

The user can just use the system-provided HTTP proxy server or a custom one.

This feature is also capable of handling the following situations.

HTTP Proxy Mode

Mode Explanation
System Respect environment variables such as http_proxy, HTTPS_PROXY and NO_PROXY
Disabled Completely ignore environment variables
Custom Use custom HTTP proxy address and ignore NO_PROXY environment variable

Logging

Task run results are logged at

Free Forever

You DON'T need to worry that some features are not free or this repository will be silently deleted or even the entire extension becomes a paid one.

You can use this extension in your projects as an open dependency.

License: Open Software License (OSL 3.0)

Although this is a Free extension, it is aiming to be professional, fit most business scenarios and become a complement of Magento's Page Caching feature. If you have good ideas about this extension, do not hesitate to share them.

Installation

Requirements

Important Notes: this extension is not tested on Magento 2.3, but you can give a try and any feedback is appreciated.

Install via composer

This extension requires dependencies that Magento 2 does not come with by default.
Installing to app/code will not work.

Configuration Location

Report Issues

General Issues

Use Github Issues.

Security Issues

Use the Contact Form.
NEVER OPEN A SECURITY ISSUE PUBLICLY

Customization Issues

Please contact us directly.
The "Github Issues" is only for problems residing in the extension itself.

For Developers

Translation

Current Available Languages

Translation Contribution

Dispatched Events

Miscellaneous

If you like this extension or this extension helped you, please share it and ★star☆ this repository.

You may also like:
Magento 2 Disable Customer Extension
Magento 2 Disable Customer Change Email Extension
Magento 2 Price Formatter Extension


All versions of module-cache-warmer with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
magento/magento2-base Version ~2.3.0 || ~2.4.0
vipnytt/sitemapparser Version ^1.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wubinworks/module-cache-warmer contains the following files

Loading the files please wait ....