### Install Cache Igniter via Composer Source: https://putyourlightson.com/plugins/cache-igniter/index Installs the Cache Igniter plugin for Craft CMS using Composer. This is the recommended method for adding the plugin to your project. ```bash composer require putyourlightson/craft-cache-igniter ``` -------------------------------- ### Register Warmer via Event Listener Source: https://putyourlightson.com/plugins/cache-igniter/index This example demonstrates how to register a custom warmer class programmatically. It involves listening for the `EVENT_REGISTER_WARMER_TYPES` event on `WarmerHelper` and adding your custom warmer class to the `$event->types` array within the event handler function. ```php use craft\events\RegisterComponentTypesEvent; use putyourlightson\cacheigniter\helpers\WarmerHelper; use vendor\package\MyWarmer; use yii\base\Event; Event::on(WarmerHelper::class, WarmerHelper::EVENT_REGISTER_WARMER_TYPES, function(RegisterComponentTypesEvent $event) { $event->types[] = MyWarmer::class; } ); ``` -------------------------------- ### Create Custom Warmer Class Source: https://putyourlightson.com/plugins/cache-igniter/index This snippet shows the basic structure for creating a custom warmer by extending the abstract `BaseWarmer` class. You will need to override the base methods to define your warmer's logic. Ensure you import the necessary `BaseCacheGenerator` class. ```php use putyourlightson\cacheigniter\drivers\warmers\BaseCacheGenerator; class MyWarmer extends BaseWarmer { // Override base methods } ``` -------------------------------- ### Cache Igniter Console Commands Source: https://putyourlightson.com/plugins/cache-igniter/index Provides commands to manually warm cache URLs or pending URLs. These commands are essential for triggering cache updates and ensuring content freshness. ```APIDOC Command: cache-igniter/warm/urls Description: Warms one or more provided comma-separated URLs. Parameters: - urls (string): A comma-separated list of URLs to warm. Example: php craft cache-igniter/warm/urls \ https://putyourlightson.com,https://putyourlightson.com/articles Command: cache-igniter/warm/pending-urls Description: Warms any URLs that are pending warming. URLs are put into a warm pending state when the Blitz cache is refreshed, according to the Blitz Refresh settings. Parameters: None. Example: php craft cache-igniter/warm/pending-urls ``` -------------------------------- ### Register Warmer via Composer Configuration Source: https://putyourlightson.com/plugins/cache-igniter/index To register a custom warmer class that is part of a separate composer package, add its fully qualified class name to the `warmerTypes` array within the `config/cache-igniter.php` file. This method is suitable for standalone warmer packages. ```php // The warmer type classes to add to the plugin’s default warmer types. 'warmerTypes' => [ 'vendor\package\MyWarmer' ], ``` -------------------------------- ### Cache Igniter Scheduled Warming Command Source: https://putyourlightson.com/plugins/cache-igniter/index Warms cached pages on a schedule using a cron job. This command accepts one or more comma-separated URLs and warms them immediately. It's useful for ensuring specific pages are kept warm. ```APIDOC php craft cache-igniter/warm/urls [urls] Warms cached pages on a schedule. Parameters: urls (string): One or more comma-separated URLs to warm. Example: "https://example.com,https://example.com/about" Usage Example: php craft cache-igniter/warm/urls \ https://putyourlightson.com,https://putyourlightson.com/articles Returns: The command executes the warming process for the specified URLs. ``` -------------------------------- ### Configure Custom Queue for Cache Igniter Source: https://putyourlightson.com/plugins/cache-igniter/index This PHP code snippet demonstrates how to configure Cache Igniter to use a custom queue in Craft CMS. It specifies a custom queue component and assigns it to the plugin's configuration, allowing long-running queue jobs to run independently from Craft's default queue. ```php return [ 'bootstrap' => ['customQueue'], 'components' => [ 'plugins' => [ 'pluginConfigs' => [ 'cache-igniter' => [ 'queue' => 'customQueue', ], ], ], 'customQueue' => [ 'class' => \craft\queue\Queue::class, 'channel' => 'custom', ], ], ]; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.