Crawling strategy 2.0+ ​
📝 Name: strategy
· 🖥️ Option: -s
, --strategy
Optional crawling strategy to prepare URLs before crawling them.
Sort by changefreq
​
Sorts collected URLs by their changefreq
value in an XML sitemap before crawling them.
bash
./cache-warmup.phar -s sort-by-changefreq
./cache-warmup.phar --strategy sort-by-changefreq
json
{
"strategy": "sort-by-changefreq"
}
php
use EliasHaeussler\CacheWarmup;
return static function (CacheWarmup\Config\CacheWarmupConfig $config) {
$config->setStrategy(
new CacheWarmup\Crawler\Strategy\SortByChangeFrequencyStrategy(),
);
return $config;
};
yaml
strategy: sort-by-changefreq
bash
CACHE_WARMUP_STRATEGY=sort-by-changefreq
Sort by lastmod
​
Sorts collected URLs by their lastmod
value in an XML sitemap before crawling them.
bash
./cache-warmup.phar -s sort-by-lastmod
./cache-warmup.phar --strategy sort-by-lastmod
json
{
"strategy": "sort-by-lastmod"
}
php
use EliasHaeussler\CacheWarmup;
return static function (CacheWarmup\Config\CacheWarmupConfig $config) {
$config->setStrategy(
new CacheWarmup\Crawler\Strategy\SortByLastModificationDateStrategy(),
);
return $config;
};
yaml
strategy: sort-by-lastmod
bash
CACHE_WARMUP_STRATEGY=sort-by-lastmod
Sort by priority
​
Sorts collected URLs by their priority
value in an XML sitemap before crawling them.
bash
./cache-warmup.phar -s sort-by-priority
./cache-warmup.phar --strategy sort-by-priority
json
{
"strategy": "sort-by-priority"
}
php
use EliasHaeussler\CacheWarmup;
return static function (CacheWarmup\Config\CacheWarmupConfig $config) {
$config->setStrategy(
new CacheWarmup\Crawler\Strategy\SortByPriorityStrategy(),
);
return $config;
};
yaml
strategy: sort-by-priority
bash
CACHE_WARMUP_STRATEGY=sort-by-priority