Crawlers
The extension uses crawlers to visit all URLs configured for cache warmup. While visiting a URL, the appropriate page cache gets warmed. Learn more about which crawlers are available by default and how to implement a custom crawler on this page.
- interface CrawlerInterface
-
- Fully qualified name
-
\Elias
Haeussler\ Cache Warmup\ Crawler\ Crawler Interface
Interface for crawlers used to crawl and warm up URLs.
Default crawlers
The extension ships with two default crawlers:
- eliashaeussler-typo3warming-crawler-concurrentuseragentcrawler: Used for cache warmup triggered within the TYPO3 backend
- eliashaeussler-typo3warming-crawler-outputtinguseragentcrawler: Used for cache warmup executed from the command-line
Both crawlers use a custom User- header for all warmup
requests. By using this custom header, it is possible to exclude
warmup requests from the statistics of analysis tools, for example.
The header is generated by a HMAC hash of the string
TYPO3/.
The generated header value can be copied in the dropdown of the
toolbar item in the backend. Alternatively, a command
warming: is available which can be used to read the
current User- header.
Implement a custom crawler
Available interfaces
The actual cache warmup is done via the library eliashaeussler/cache-warmup. It provides the \EliasHaeussler\CacheWarmup\Crawler\CrawlerInterface, which must be implemented when developing your own crawler. There is also a eliashaeussler-cachewarmup-crawler-verbosecrawlerinterface that redirects user-oriented output to an instance of symfony-component-console-output-outputinterface.
Configurable crawlers
Since version 0.7.13 of eliashaeussler/, custom
crawlers can also implement the
eliashaeussler-cachewarmup-crawler-configurablecrawlerinterface,
allowing users to configure warmup requests themselves.
See also
Feature #59 - Introduce configurable crawlers
of eliashaeussler/ library
Steps to implement a new crawler
-
Create a new crawler
The new crawler must implement one of the following interfaces:
- \EliasHaeussler\CacheWarmup\Crawler\CrawlerInterface
- eliashaeussler-cachewarmup-crawler-verbosecrawlerinterface
- eliashaeussler-cachewarmup-crawler-configurablecrawlerinterface
Tip
This extension provides some additional traits which you can use for your new crawler:
- eliashaeussler-typo3warming-crawler-requestawaretrait
- eliashaeussler-typo3warming-crawler-useagenttrait
-
Configure the new crawler
Add the new crawler to the extension configuration. Note that you should configure either the
crawlerorverboseoption, depending on what interface you have implemented.Crawler -
Flush system caches
Finally, flush all system caches to ensure the correct crawler class is used for further cache warmup requests.