Skip to content

Commit 0eb4d25

Browse files
committed
docs: Add interceptor binding information to cache attributes
- Document which interceptors are bound to each cache attribute - Add direct links to BEAR.Sunday manual sections with hash fragments - Improve code readability for developers understanding the caching system Attributes updated: - Cacheable: CacheInterceptor, CommandInterceptor - HttpCache/NoHttpCache: HttpCacheInterceptor - Purge/Refresh: RefreshInterceptor, CommandInterceptor - DonutCache: DonutCacheInterceptor - CacheableResponse: DonutCacheableResponseInterceptor, DonutCommandInterceptor - RefreshCache: DonutCacheInterceptor
1 parent a039994 commit 0eb4d25

8 files changed

Lines changed: 57 additions & 7 deletions

File tree

src-annotation/Cacheable.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@
66

77
use Attribute;
88

9+
/**
10+
* Marks a resource class as cacheable with TTL-based caching
11+
*
12+
* Interceptors bound:
13+
* - CacheInterceptor (onGet methods)
14+
* - CommandInterceptor (onPut/onPatch/onDelete methods)
15+
*
16+
* @see https://bearsunday.github.io/manuals/1.0/en/cache.html#cacheable
17+
*/
918
#[Attribute(Attribute::TARGET_CLASS)]
1019
final class Cacheable
1120
{

src-annotation/CacheableResponse.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,15 @@
1010
use BEAR\QueryRepository\DonutCommandInterceptor;
1111

1212
/**
13+
* Marks a resource for full response caching (entire content is cacheable)
14+
*
15+
* Interceptors bound:
16+
* - DonutCacheableResponseInterceptor (onGet methods when applied to class)
17+
* - DonutCommandInterceptor (onPut/onPatch/onDelete methods when applied to class)
18+
* - DonutCacheInterceptor (when applied to method)
19+
*
1320
* @see DonutCacheModule
14-
* @see DonutCacheableResponseInterceptor
15-
* @see DonutCommandInterceptor
21+
* @see https://bearsunday.github.io/manuals/1.0/en/cache.html#donut-cache
1622
*/
1723
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_CLASS)]
1824
final class CacheableResponse

src-annotation/DonutCache.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@
99
use BEAR\QueryRepository\DonutCommandInterceptor;
1010

1111
/**
12+
* Marks a resource for donut caching (partial caching with embedded dynamic content)
13+
*
14+
* Interceptors bound:
15+
* - DonutCacheInterceptor (onGet methods when applied to class, or any method when applied to method)
16+
*
1217
* @see DonutCacheModule
13-
* @see DonutCacheInterceptor
14-
* @see DonutCommandInterceptor
18+
* @see https://bearsunday.github.io/manuals/1.0/en/cache.html#donut-cache
1519
*/
1620
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_CLASS)]
1721
final class DonutCache

src-annotation/HttpCache.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
*
1616
* Builds a complex Cache-Control header
1717
*
18+
* Interceptors bound:
19+
* - HttpCacheInterceptor (onGet methods)
20+
*
1821
* @see HttpCacheInterceptor
22+
* @see https://bearsunday.github.io/manuals/1.0/en/cache.html
1923
*/
2024
#[Attribute(Attribute::TARGET_CLASS)]
2125
final class HttpCache extends AbstractCacheControl

src-annotation/NoHttpCache.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
*
1313
* Simplified notation to say that you don't want anything cached
1414
*
15+
* Interceptors bound:
16+
* - HttpCacheInterceptor (onGet methods)
17+
*
1518
* @see HttpCacheInterceptor
19+
* @see https://bearsunday.github.io/manuals/1.0/en/cache.html
1620
*/
1721
#[Attribute(Attribute::TARGET_CLASS)]
1822
final class NoHttpCache extends AbstractCacheControl

src-annotation/Purge.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@
66

77
use Attribute;
88

9-
/** @see RefreshInterceptor */
9+
/**
10+
* Purges cache for specified URI after command execution
11+
*
12+
* Interceptors bound:
13+
* - RefreshInterceptor (when applied to non-Cacheable classes)
14+
* - CommandInterceptor (when applied to Cacheable classes)
15+
*
16+
* @see https://bearsunday.github.io/manuals/1.0/en/cache.html#tag-based-cache-invalidation
17+
*/
1018
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
1119
final class Purge extends AbstractCommand
1220
{

src-annotation/Refresh.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@
77
use Attribute;
88
use BEAR\QueryRepository\RefreshInterceptor;
99

10-
/** @see RefreshInterceptor */
10+
/**
11+
* Refreshes cache for specified URI after command execution
12+
*
13+
* Interceptors bound:
14+
* - RefreshInterceptor (when applied to non-Cacheable classes)
15+
* - CommandInterceptor (when applied to Cacheable classes)
16+
*
17+
* @see https://bearsunday.github.io/manuals/1.0/en/cache.html#event-driven-content
18+
*/
1119
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
1220
final class Refresh extends AbstractCommand
1321
{

src-annotation/RefreshCache.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77
use Attribute;
88
use BEAR\QueryRepository\DonutCommandInterceptor;
99

10-
/** @see DonutCommandInterceptor */
10+
/**
11+
* Refreshes donut cache after command execution
12+
*
13+
* Interceptors bound:
14+
* - DonutCacheInterceptor
15+
*
16+
* @see https://bearsunday.github.io/manuals/1.0/en/cache.html#cache-invalidation
17+
*/
1118
#[Attribute(Attribute::TARGET_METHOD)]
1219
final class RefreshCache
1320
{

0 commit comments

Comments
 (0)