File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717
1818use const E_USER_WARNING ;
1919
20+ /**
21+ * Interceptor for TTL-based caching on CQRS queries with #[Cacheable]
22+ *
23+ * Bound to query methods (onGet) of classes marked with #[Cacheable].
24+ * Retrieves cached resource state if available, otherwise executes
25+ * the method and stores the result with configured TTL.
26+ *
27+ * @see \BEAR\RepositoryModule\Annotation\Cacheable
28+ * @see https://bearsunday.github.io/manuals/1.0/en/cache.html#cacheable
29+ */
2030final readonly class CacheInterceptor implements MethodInterceptor
2131{
2232 public function __construct (
Original file line number Diff line number Diff line change 1212use Ray \Aop \MethodInterceptor ;
1313use Ray \Aop \MethodInvocation ;
1414
15+ /**
16+ * Interceptor for cache invalidation on CQRS commands with #[Purge] or #[Refresh]
17+ *
18+ * Bound to command methods (onPut/onPatch/onDelete) of #[Cacheable] classes.
19+ * Executes cache invalidation after successful write operations.
20+ *
21+ * @see \BEAR\RepositoryModule\Annotation\Purge
22+ * @see \BEAR\RepositoryModule\Annotation\Refresh
23+ * @see https://bearsunday.github.io/manuals/1.0/en/cache.html#tag-based-cache-invalidation
24+ */
1525final readonly class CommandInterceptor implements MethodInterceptor
1626{
1727 /** @param CommandInterface[] $commands */
Original file line number Diff line number Diff line change 44
55namespace BEAR \QueryRepository ;
66
7+ /**
8+ * Interceptor for donut caching on CQRS queries with #[DonutCache]
9+ *
10+ * Bound to query methods (onGet) or individual methods marked with #[DonutCache].
11+ * Caches only the cacheable portions, excluding non-cacheable embedded content.
12+ * No ETag is generated for the entire response.
13+ *
14+ * @see \BEAR\RepositoryModule\Annotation\DonutCache
15+ * @see https://bearsunday.github.io/manuals/1.0/en/cache.html#donut-cache
16+ */
717final class DonutCacheInterceptor extends AbstractDonutCacheInterceptor
818{
919 protected const IS_ENTIRE_CONTENT_CACHEABLE = false ;
Original file line number Diff line number Diff line change 44
55namespace BEAR \QueryRepository ;
66
7+ /**
8+ * Interceptor for full response caching on CQRS queries with #[CacheableResponse]
9+ *
10+ * Bound to query methods (onGet) of classes marked with #[CacheableResponse].
11+ * Caches the entire response and generates an ETag for conditional requests.
12+ * Enables 304 (Not Modified) responses for efficient network transfer.
13+ *
14+ * @see \BEAR\RepositoryModule\Annotation\CacheableResponse
15+ * @see https://bearsunday.github.io/manuals/1.0/en/cache.html#event-driven-content
16+ */
717final class DonutCacheableResponseInterceptor extends AbstractDonutCacheInterceptor
818{
919 protected const IS_ENTIRE_CONTENT_CACHEABLE = true ;
Original file line number Diff line number Diff line change 1919use function is_callable ;
2020use function sprintf ;
2121
22+ /**
23+ * Interceptor for donut cache invalidation on CQRS commands
24+ *
25+ * Bound to command methods (onPut/onPatch/onDelete) of classes marked with #[CacheableResponse].
26+ * Refreshes donut cache and resource state after successful write operations.
27+ *
28+ * @see \BEAR\RepositoryModule\Annotation\CacheableResponse
29+ * @see \BEAR\RepositoryModule\Annotation\DonutCache
30+ * @see https://bearsunday.github.io/manuals/1.0/en/cache.html#event-driven-content
31+ */
2232final readonly class DonutCommandInterceptor implements MethodInterceptor
2333{
2434 public function __construct (
Original file line number Diff line number Diff line change 1414
1515use function assert ;
1616
17+ /**
18+ * Interceptor for HTTP Cache-Control header with #[HttpCache] or #[NoHttpCache]
19+ *
20+ * Bound to onGet methods of classes marked with #[HttpCache] or #[NoHttpCache].
21+ * Sets the Cache-Control header based on attribute configuration for HTTP caching.
22+ *
23+ * @see \BEAR\RepositoryModule\Annotation\HttpCache
24+ * @see \BEAR\RepositoryModule\Annotation\NoHttpCache
25+ * @see https://bearsunday.github.io/manuals/1.0/en/cache.html
26+ */
1727final class HttpCacheInterceptor implements MethodInterceptor
1828{
1929 /**
Original file line number Diff line number Diff line change 1111use Ray \Aop \MethodInterceptor ;
1212use Ray \Aop \MethodInvocation ;
1313
14+ /**
15+ * Interceptor for cache refresh commands with #[Purge] or #[Refresh]
16+ *
17+ * Bound to methods marked with #[Purge] or #[Refresh] on non-Cacheable classes.
18+ * Executes cache invalidation commands after successful method execution.
19+ *
20+ * @see \BEAR\RepositoryModule\Annotation\Purge
21+ * @see \BEAR\RepositoryModule\Annotation\Refresh
22+ * @see https://bearsunday.github.io/manuals/1.0/en/cache.html#event-driven-content
23+ */
1424final readonly class RefreshInterceptor implements MethodInterceptor
1525{
1626 public function __construct (
You can’t perform that action at this time.
0 commit comments