diff options
Diffstat (limited to 'vendor/symfony/cache-contracts/ItemInterface.php')
-rw-r--r-- | vendor/symfony/cache-contracts/ItemInterface.php | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/vendor/symfony/cache-contracts/ItemInterface.php b/vendor/symfony/cache-contracts/ItemInterface.php new file mode 100644 index 0000000..8c4c512 --- /dev/null +++ b/vendor/symfony/cache-contracts/ItemInterface.php | |||
@@ -0,0 +1,65 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Contracts\Cache; | ||
13 | |||
14 | use Psr\Cache\CacheException; | ||
15 | use Psr\Cache\CacheItemInterface; | ||
16 | use Psr\Cache\InvalidArgumentException; | ||
17 | |||
18 | /** | ||
19 | * Augments PSR-6's CacheItemInterface with support for tags and metadata. | ||
20 | * | ||
21 | * @author Nicolas Grekas <p@tchwork.com> | ||
22 | */ | ||
23 | interface ItemInterface extends CacheItemInterface | ||
24 | { | ||
25 | /** | ||
26 | * References the Unix timestamp stating when the item will expire. | ||
27 | */ | ||
28 | public const METADATA_EXPIRY = 'expiry'; | ||
29 | |||
30 | /** | ||
31 | * References the time the item took to be created, in milliseconds. | ||
32 | */ | ||
33 | public const METADATA_CTIME = 'ctime'; | ||
34 | |||
35 | /** | ||
36 | * References the list of tags that were assigned to the item, as string[]. | ||
37 | */ | ||
38 | public const METADATA_TAGS = 'tags'; | ||
39 | |||
40 | /** | ||
41 | * Reserved characters that cannot be used in a key or tag. | ||
42 | */ | ||
43 | public const RESERVED_CHARACTERS = '{}()/\@:'; | ||
44 | |||
45 | /** | ||
46 | * Adds a tag to a cache item. | ||
47 | * | ||
48 | * Tags are strings that follow the same validation rules as keys. | ||
49 | * | ||
50 | * @param string|string[] $tags A tag or array of tags | ||
51 | * | ||
52 | * @return $this | ||
53 | * | ||
54 | * @throws InvalidArgumentException When $tag is not valid | ||
55 | * @throws CacheException When the item comes from a pool that is not tag-aware | ||
56 | */ | ||
57 | public function tag(string|iterable $tags): static; | ||
58 | |||
59 | /** | ||
60 | * Returns a list of metadata info that were saved alongside with the cached value. | ||
61 | * | ||
62 | * See ItemInterface::METADATA_* consts for keys potentially found in the returned array. | ||
63 | */ | ||
64 | public function getMetadata(): array; | ||
65 | } | ||