Option Reference
The CacheWarmer
class accepts a limited set of configuration options. They can be provided as constructor parameters.
limit
🐝 Default: 0
Same as the
limit
configuration option.
php
use EliasHaeussler\CacheWarmup;
$cacheWarmer = new CacheWarmup\CacheWarmer(
limit: 10,
);
$cacheWarmer->run();
crawler
🐝 Default: new EliasHaeussler\CacheWarmup\Crawler\ConcurrentCrawler()
Same as the
crawler
configuration option.
php
use EliasHaeussler\CacheWarmup;
$cacheWarmer = new CacheWarmup\CacheWarmer(
crawler: new \Vendor\Crawler\MyCustomCrawler(),
);
$cacheWarmer->run();
strategy
🐝 Default: null
Same as the
strategy
configuration option.
php
use EliasHaeussler\CacheWarmup;
$cacheWarmer = new CacheWarmup\CacheWarmer(
strategy: new CacheWarmup\Crawler\Strategy\SortByPriorityStrategy(),
);
$cacheWarmer->run();
parser
🐝 Default: new EliasHaeussler\CacheWarmup\Xml\SitemapXmlParser()
Same as the
parser
configuration option.
php
use EliasHaeussler\CacheWarmup;
$cacheWarmer = new CacheWarmup\CacheWarmer(
parser: new \Vendor\Xml\MyCustomParser(),
);
$cacheWarmer->run();
strict
🐝 Default: true
Opposite of the
allowFailures
configuration option.
php
use EliasHaeussler\CacheWarmup;
$cacheWarmer = new CacheWarmup\CacheWarmer(
strict: false,
);
$cacheWarmer->run();
excludePatterns
🐝 Default: []
Same as the
exclude
configuration option.
php
use EliasHaeussler\CacheWarmup;
$cacheWarmer = new CacheWarmup\CacheWarmer(
excludePatterns: [
CacheWarmup\Config\Option\ExcludePattern::create('*foo*'),
],
);
$cacheWarmer->run();
eventDispatcher
🐝 Default: new Symfony\Component\EventDispatcher\EventDispatcher()
Dispatches several events during the cache warmup progress.
php
use EliasHaeussler\CacheWarmup;
use Symfony\Component\EventDispatcher;
$eventDispatcher = new EventDispatcher\EventDispatcher();
$eventDispatcher->addListener(
CacheWarmup\Event\Parser\SitemapParsed::class,
new \Vendor\EventListener\OnSitemapParsedListener(),
);
$cacheWarmer = new CacheWarmup\CacheWarmer(
eventDispatcher: $eventDispatcher,
);
$cacheWarmer->run();