-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAsyncIslandProviderInterface.php
More file actions
38 lines (32 loc) · 1019 Bytes
/
AsyncIslandProviderInterface.php
File metadata and controls
38 lines (32 loc) · 1019 Bytes
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
<?php
declare(strict_types=1);
namespace Toppy\AsyncViewModel;
use Amp\Future;
use Toppy\AsyncViewModel\Context\RequestContext;
use Toppy\AsyncViewModel\Context\ViewContext;
/**
* Contract for async view model data providers.
*
* Implementations fetch data asynchronously. The template path
* and skeleton are determined by convention, not by the provider.
*/
interface AsyncIslandProviderInterface
{
/**
* Fetch data asynchronously.
*
* @return Future<mixed> The resolved data
*/
public function resolve(ViewContext $viewContext, RequestContext $requestContext): Future;
/**
* Unique cache key for this instance.
* Used with Twig cache block.
*/
public function getCacheKey(ViewContext $viewContext, RequestContext $requestContext): string;
/**
* Tags for cache invalidation.
*
* @return string[] e.g., ['product_123', 'stock']
*/
public function getCacheTags(ViewContext $viewContext, RequestContext $requestContext): array;
}