Skip to content

Commit 80427ec

Browse files
[Cache] Enable namespace-based invalidation by prefixing keys with backend-native namespace separators
1 parent fdc4e31 commit 80427ec

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
---
66

77
* Make `HttpClientTestCase` and `TranslatorTest` compatible with PHPUnit 10+
8+
* Add `NamespacedPoolInterface` to support namespace-based invalidation
89

910
3.5
1011
---

Cache/NamespacedPoolInterface.php

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
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\InvalidArgumentException;
15+
16+
/**
17+
* Enables namespace-based invalidation by prefixing keys with backend-native namespace separators.
18+
*
19+
* Note that calling `withSubNamespace()` MUST NOT mutate the pool, but return a new instance instead.
20+
*
21+
* When tags are used, they MUST ignore sub-namespaces.
22+
*
23+
* @author Nicolas Grekas <[email protected]>
24+
*/
25+
interface NamespacedPoolInterface
26+
{
27+
/**
28+
* @throws InvalidArgumentException If the namespace contains characters found in ItemInterface's RESERVED_CHARACTERS
29+
*/
30+
public function withSubNamespace(string $namespace): static;
31+
}

0 commit comments

Comments
 (0)