File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99/**
1010 * Purges cache for specified URI after command execution
1111 *
12+ * Behavior differs based on class attributes:
13+ * - **#[Cacheable] classes**: CommandInterceptor automatically binds to all
14+ * command methods (onPut/onPatch/onDelete) and processes #[Purge] annotations
15+ * - **Non-Cacheable classes**: RefreshInterceptor binds only to methods explicitly
16+ * marked with #[Purge] or #[Refresh]
17+ *
1218 * Example:
1319 * ```php
1420 * #[Purge(uri: 'app://self/user/profile?user_id={id}')]
1521 * #[Purge(uri: 'app://self/user/friend?user_id={id}')]
1622 * public function onDelete(int $id): static
1723 * ```
1824 *
19- * Interceptors bound:
20- * - RefreshInterceptor (when applied to non-Cacheable classes)
21- * - CommandInterceptor (when applied to Cacheable classes)
22- *
2325 * @see https://bearsunday.github.io/manuals/1.0/en/cache.html#tag-based-cache-invalidation
2426 */
2527#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE )]
Original file line number Diff line number Diff line change 99/**
1010 * Refreshes cache for specified URI after command execution
1111 *
12+ * Behavior differs based on class attributes:
13+ * - **#[Cacheable] classes**: CommandInterceptor automatically binds to all
14+ * command methods (onPut/onPatch/onDelete) and processes #[Refresh] annotations
15+ * - **Non-Cacheable classes**: RefreshInterceptor binds only to methods explicitly
16+ * marked with #[Purge] or #[Refresh]
17+ *
1218 * Example:
1319 * ```php
1420 * #[Refresh(uri: 'app://self/user/profile?user_id={id}')]
1521 * public function onPut(int $id, string $name): static
1622 * ```
1723 *
18- * Interceptors bound:
19- * - RefreshInterceptor (when applied to non-Cacheable classes)
20- * - CommandInterceptor (when applied to Cacheable classes)
21- *
2224 * @see https://bearsunday.github.io/manuals/1.0/en/cache.html#event-driven-content
2325 */
2426#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE )]
Original file line number Diff line number Diff line change 1515/**
1616 * Interceptor for cache invalidation on CQRS commands with #[Purge] or #[Refresh]
1717 *
18- * Bound to command methods (onPut/onPatch/onDelete) of #[Cacheable] classes.
19- * Executes cache invalidation after successful write operations.
18+ * Automatically bound to all command methods (onPut/onPatch/onDelete) of #[Cacheable] classes.
19+ * Processes #[Purge] and #[Refresh] annotations on these methods and executes cache
20+ * invalidation after successful write operations.
21+ *
22+ * For non-Cacheable classes, use RefreshInterceptor instead by explicitly marking methods
23+ * with #[Purge] or #[Refresh].
2024 *
2125 * @see \BEAR\RepositoryModule\Annotation\Purge
2226 * @see \BEAR\RepositoryModule\Annotation\Refresh
Original file line number Diff line number Diff line change 1414/**
1515 * Interceptor for cache refresh commands with #[Purge] or #[Refresh]
1616 *
17- * Bound to methods marked with #[Purge] or #[Refresh] on non-Cacheable classes.
17+ * Bound only to methods explicitly marked with #[Purge] or #[Refresh] on non-Cacheable classes.
18+ * Unlike CommandInterceptor (which automatically binds to all command methods of #[Cacheable]
19+ * classes), this interceptor requires explicit attribute annotation on each method.
20+ *
1821 * Executes cache invalidation commands after successful method execution.
1922 *
2023 * @see \BEAR\RepositoryModule\Annotation\Purge
You can’t perform that action at this time.
0 commit comments