File tree Expand file tree Collapse file tree 4 files changed +54
-0
lines changed
src/Symfony/Component/Lock Expand file tree Collapse file tree 4 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 11CHANGELOG
22=========
33
4+ 7.2
5+ ---
6+
7+ * Add ` NullStore `
8+
497.0
510---
611
Original file line number Diff line number Diff line change 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 \Component \Lock \Store ;
13+
14+ use Symfony \Component \Lock \BlockingSharedLockStoreInterface ;
15+ use Symfony \Component \Lock \Key ;
16+
17+ class NullStore implements BlockingSharedLockStoreInterface
18+ {
19+ public function save (Key $ key ): void
20+ {
21+ }
22+
23+ public function delete (Key $ key ): void
24+ {
25+ }
26+
27+ public function exists (Key $ key ): bool
28+ {
29+ return false ;
30+ }
31+
32+ public function putOffExpiration (Key $ key , float $ ttl ): void
33+ {
34+ }
35+
36+ public function saveRead (Key $ key ): void
37+ {
38+ }
39+
40+ public function waitAndSaveRead (Key $ key ): void
41+ {
42+ }
43+ }
Original file line number Diff line number Diff line change @@ -106,6 +106,9 @@ public static function createStore(#[\SensitiveParameter] object|string $connect
106106
107107 case 'in-memory ' === $ connection :
108108 return new InMemoryStore ();
109+
110+ case 'null ' === $ connection :
111+ return new NullStore ();
109112 }
110113
111114 throw new InvalidArgumentException (\sprintf ('Unsupported Connection: "%s". ' , $ connection ));
Original file line number Diff line number Diff line change 2020use Symfony \Component \Lock \Store \FlockStore ;
2121use Symfony \Component \Lock \Store \InMemoryStore ;
2222use Symfony \Component \Lock \Store \MemcachedStore ;
23+ use Symfony \Component \Lock \Store \NullStore ;
2324use Symfony \Component \Lock \Store \PdoStore ;
2425use Symfony \Component \Lock \Store \PostgreSqlStore ;
2526use Symfony \Component \Lock \Store \RedisStore ;
@@ -92,5 +93,7 @@ public static function validConnections(): \Generator
9293
9394 yield ['flock ' , FlockStore::class];
9495 yield ['flock:// ' .sys_get_temp_dir (), FlockStore::class];
96+
97+ yield ['null ' , NullStore::class];
9598 }
9699}
You can’t perform that action at this time.
0 commit comments