File tree 4 files changed +54
-0
lines changed
src/Symfony/Component/Lock
4 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 1
1
CHANGELOG
2
2
=========
3
3
4
+ 7.2
5
+ ---
6
+
7
+ * Add ` NullStore `
8
+
4
9
7.0
5
10
---
6
11
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 <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 \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
106
106
107
107
case 'in-memory ' === $ connection :
108
108
return new InMemoryStore ();
109
+
110
+ case 'null ' === $ connection :
111
+ return new NullStore ();
109
112
}
110
113
111
114
throw new InvalidArgumentException (\sprintf ('Unsupported Connection: "%s". ' , $ connection ));
Original file line number Diff line number Diff line change 20
20
use Symfony \Component \Lock \Store \FlockStore ;
21
21
use Symfony \Component \Lock \Store \InMemoryStore ;
22
22
use Symfony \Component \Lock \Store \MemcachedStore ;
23
+ use Symfony \Component \Lock \Store \NullStore ;
23
24
use Symfony \Component \Lock \Store \PdoStore ;
24
25
use Symfony \Component \Lock \Store \PostgreSqlStore ;
25
26
use Symfony \Component \Lock \Store \RedisStore ;
@@ -92,5 +93,7 @@ public static function validConnections(): \Generator
92
93
93
94
yield ['flock ' , FlockStore::class];
94
95
yield ['flock:// ' .sys_get_temp_dir (), FlockStore::class];
96
+
97
+ yield ['null ' , NullStore::class];
95
98
}
96
99
}
You can’t perform that action at this time.
0 commit comments