File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77use Attribute ;
88
99/**
10- * Marks a resource class as cacheable with TTL-based caching
10+ * Marks a resource class as cacheable with TTL-based expiration
11+ *
12+ * Traditional time-based caching where cache expires after a specified duration.
13+ * For event-driven cache invalidation based on resource dependencies, use
14+ * #[CacheableResponse] or #[DonutCache] instead.
1115 *
1216 * Interceptors bound:
1317 * - CacheInterceptor (onGet methods)
Original file line number Diff line number Diff line change 55namespace BEAR \RepositoryModule \Annotation ;
66
77use Attribute ;
8- use BEAR \QueryRepository \DonutCacheableResponseInterceptor ;
98use BEAR \QueryRepository \DonutCacheModule ;
10- use BEAR \QueryRepository \DonutCommandInterceptor ;
119
1210/**
13- * Marks a resource for full response caching (entire content is cacheable)
11+ * Enables event-driven cache invalidation for fully cacheable responses
12+ *
13+ * For content that is fundamentally static but changes predictably via resource
14+ * methods (onPut, onDelete, etc.). Unlike #[Cacheable] which uses TTL-based
15+ * expiration, this enables tag-based invalidation driven by resource dependencies.
16+ * The entire response is cached and receives an ETag for conditional requests,
17+ * enabling 304 (Not Modified) responses to reduce network transfer costs.
1418 *
1519 * Interceptors bound:
1620 * - DonutCacheableResponseInterceptor (onGet methods when applied to class)
1721 * - DonutCommandInterceptor (onPut/onPatch/onDelete methods when applied to class)
1822 * - DonutCacheInterceptor (when applied to method)
1923 *
2024 * @see DonutCacheModule
21- * @see https://bearsunday.github.io/manuals/1.0/en/cache.html#donut-cache
25+ * @see https://bearsunday.github.io/manuals/1.0/en/cache.html#event-driven-content
2226 */
2327#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_CLASS )]
2428final class CacheableResponse
Original file line number Diff line number Diff line change 66
77use Attribute ;
88use BEAR \QueryRepository \DonutCacheModule ;
9- use BEAR \QueryRepository \DonutCommandInterceptor ;
109
1110/**
12- * Marks a resource for donut caching (partial caching with embedded dynamic content)
11+ * Enables event-driven donut caching for resources with non-cacheable embedded content
12+ *
13+ * For content that is fundamentally static but changes predictably via resource
14+ * methods, with some embedded resources that cannot be cached. Unlike #[Cacheable]
15+ * which uses TTL-based expiration, this enables tag-based invalidation. Only
16+ * cacheable portions are stored; no ETag is generated for the entire response.
1317 *
1418 * Interceptors bound:
1519 * - DonutCacheInterceptor (onGet methods when applied to class, or any method when applied to method)
Original file line number Diff line number Diff line change 55namespace BEAR \RepositoryModule \Annotation ;
66
77use Attribute ;
8- use BEAR \QueryRepository \RefreshInterceptor ;
98
109/**
1110 * Refreshes cache for specified URI after command execution
Original file line number Diff line number Diff line change 55namespace BEAR \RepositoryModule \Annotation ;
66
77use Attribute ;
8- use BEAR \QueryRepository \DonutCommandInterceptor ;
98
109/**
1110 * Refreshes donut cache after command execution
You can’t perform that action at this time.
0 commit comments