-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDonutCache.php
More file actions
40 lines (36 loc) · 1.1 KB
/
DonutCache.php
File metadata and controls
40 lines (36 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
declare(strict_types=1);
namespace BEAR\RepositoryModule\Annotation;
use Attribute;
use BEAR\QueryRepository\DonutCacheModule;
/**
* Enables event-driven donut caching for resources with non-cacheable embedded content
*
* For content that is fundamentally static but changes predictably via resource
* methods, with some embedded resources that cannot be cached. Unlike #[Cacheable]
* which uses TTL-based expiration, this enables tag-based invalidation. Only
* cacheable portions are stored; no ETag is generated for the entire response.
*
* Example:
* ```php
* #[DonutCache]
* class BlogPosting extends ResourceObject
* {
* #[Embed(rel: 'comment', src: 'app://self/comments')]
* public function onGet(int $id): static
* {
* // ...
* }
* }
* ```
*
* Interceptors bound:
* - DonutCacheInterceptor (onGet methods when applied to class, or any method when applied to method)
*
* @see DonutCacheModule
* @see https://bearsunday.github.io/manuals/1.0/en/cache.html#donut-cache
*/
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_CLASS)]
final class DonutCache
{
}