|
18 | 18 | use Symfony\Component\Lock\Exception\LockConflictedException;
|
19 | 19 | use Symfony\Component\Lock\Exception\NotSupportedException;
|
20 | 20 | use Symfony\Component\Lock\Key;
|
| 21 | +use Symfony\Component\Lock\PersistStoreInterface; |
21 | 22 | use Symfony\Component\Lock\StoreInterface;
|
22 | 23 | use Symfony\Component\Lock\Strategy\StrategyInterface;
|
23 | 24 |
|
|
26 | 27 | *
|
27 | 28 | * @author Jérémy Derussé <jeremy@derusse.com>
|
28 | 29 | */
|
29 |
| -class CombinedStore implements StoreInterface, LoggerAwareInterface |
| 30 | +class CombinedStore implements StoreInterface, PersistStoreInterface, LoggerAwareInterface |
30 | 31 | {
|
31 | 32 | use LoggerAwareTrait;
|
32 | 33 | use ExpiringStoreTrait;
|
33 | 34 |
|
34 |
| - /** @var StoreInterface[] */ |
| 35 | + /** @var PersistStoreInterface[] */ |
35 | 36 | private $stores;
|
36 | 37 | /** @var StrategyInterface */
|
37 | 38 | private $strategy;
|
38 | 39 |
|
39 | 40 | /**
|
40 |
| - * @param StoreInterface[] $stores The list of synchronized stores |
41 |
| - * @param StrategyInterface $strategy |
| 41 | + * @param PersistStoreInterface[] $stores The list of synchronized stores |
| 42 | + * @param StrategyInterface $strategy |
42 | 43 | *
|
43 | 44 | * @throws InvalidArgumentException
|
44 | 45 | */
|
45 | 46 | public function __construct(array $stores, StrategyInterface $strategy)
|
46 | 47 | {
|
47 | 48 | foreach ($stores as $store) {
|
48 |
| - if (!$store instanceof StoreInterface) { |
49 |
| - throw new InvalidArgumentException(sprintf('The store must implement "%s". Got "%s".', StoreInterface::class, \get_class($store))); |
| 49 | + if (!$store instanceof PersistStoreInterface) { |
| 50 | + throw new InvalidArgumentException(sprintf('The store must implement "%s". Got "%s".', PersistStoreInterface::class, \get_class($store))); |
50 | 51 | }
|
51 | 52 | }
|
52 | 53 |
|
@@ -92,8 +93,12 @@ public function save(Key $key)
|
92 | 93 | throw new LockConflictedException();
|
93 | 94 | }
|
94 | 95 |
|
| 96 | + /** |
| 97 | + * {@inheritdoc} |
| 98 | + */ |
95 | 99 | public function waitAndSave(Key $key)
|
96 | 100 | {
|
| 101 | + @trigger_error(sprintf('%s::%s has been deprecated since Symfony 4.4 and will be removed in Symfony 5.0.', \get_class($this), __METHOD__), E_USER_DEPRECATED); |
97 | 102 | throw new NotSupportedException(sprintf('The store "%s" does not supports blocking locks.', \get_class($this)));
|
98 | 103 | }
|
99 | 104 |
|
@@ -181,4 +186,12 @@ public function exists(Key $key)
|
181 | 186 |
|
182 | 187 | return false;
|
183 | 188 | }
|
| 189 | + |
| 190 | + /** |
| 191 | + * {@inheritdoc} |
| 192 | + */ |
| 193 | + public function supportsWaitAndSave(): bool |
| 194 | + { |
| 195 | + return false; |
| 196 | + } |
184 | 197 | }
|
0 commit comments