From 7a7c4dc7af6fa9f739655364dba6c76a9349d1e3 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 15 Oct 2026 14:34:01 +0200 Subject: [PATCH] docs #45 Give a code to the custom cache task example The DeleteTask example gets a code with #[AsTask(code: 'app_cache_delete')], relies on autoconfiguration (non-shared, cleverage_process_task logger channel, code tag) instead of a public service, and is used in a process with "task: app_cache_delete". Co-Authored-By: Claude Opus 5.5 (1M context) --- docs/index.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/index.md b/docs/index.md index 425cafb..3462551 100644 --- a/docs/index.md +++ b/docs/index.md @@ -63,8 +63,10 @@ declare(strict_types=1); namespace App\Task; use CleverAge\CacheProcessBundle\Task\AbstractCacheTask; +use CleverAge\ProcessBundle\Attribute\AsTask; use CleverAge\ProcessBundle\Model\ProcessState; +#[AsTask(code: 'app_cache_delete')] class DeleteTask extends AbstractCacheTask { public function execute(ProcessState $state): void @@ -77,15 +79,26 @@ class DeleteTask extends AbstractCacheTask } ``` +Its code is given by the `#[AsTask]` attribute (`cleverage/process-bundle` 5.4 or later), prefixed to avoid conflicts +with the codes of the bundles. With autoconfiguration, the task is also non-shared and logs in the +`cleverage_process_task` channel: + ```yaml # config/services.yaml services: App\Task\DeleteTask: - public: true - shared: false + autoconfigure: true arguments: ['@cleverage_cache_process.registry.adapter'] ``` +```yaml +delete_from_cache: + task: app_cache_delete + options: + adapter: app + key: my_key +``` + ## Reference - [Adapter](reference/adapter.md)