Skip to content

Commit e6aa727

Browse files
committed
docs: Clarify event-driven content is for fundamentally static content
- Emphasize EDC is for content that is fundamentally static - Changes are predictable via resource methods (onPut, onDelete, etc.) - Add 304 Not Modified benefit for network transfer cost reduction
1 parent 0eb4d25 commit e6aa727

5 files changed

Lines changed: 19 additions & 9 deletions

File tree

src-annotation/Cacheable.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
use 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)

src-annotation/CacheableResponse.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,24 @@
55
namespace BEAR\RepositoryModule\Annotation;
66

77
use Attribute;
8-
use BEAR\QueryRepository\DonutCacheableResponseInterceptor;
98
use 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)]
2428
final class CacheableResponse

src-annotation/DonutCache.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@
66

77
use Attribute;
88
use 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)

src-annotation/Refresh.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace BEAR\RepositoryModule\Annotation;
66

77
use Attribute;
8-
use BEAR\QueryRepository\RefreshInterceptor;
98

109
/**
1110
* Refreshes cache for specified URI after command execution

src-annotation/RefreshCache.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace BEAR\RepositoryModule\Annotation;
66

77
use Attribute;
8-
use BEAR\QueryRepository\DonutCommandInterceptor;
98

109
/**
1110
* Refreshes donut cache after command execution

0 commit comments

Comments
 (0)