@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | protected CacheInterface $storage, |
26 | 26 | protected ?EventDispatcherInterface $dispatcher = null, |
27 | 27 | protected ?string $prefix = null |
28 | - ) { |
|
28 | + ){ |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | public function get(string $key, mixed $default = null): mixed |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | $value = $this->storage->get($key); |
38 | 38 | |
39 | - if ($value === null) { |
|
39 | + if ($value === null){ |
|
40 | 40 | $this->dispatcher?->dispatch(new CacheMissed($key)); |
41 | 41 | |
42 | 42 | return $default; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | return $value; |
48 | 48 | } |
49 | 49 | |
50 | - public function set(string $key, mixed $value, \DateInterval|int|null $ttl = null): bool |
|
50 | + public function set(string $key, mixed $value, \DateInterval | int | null $ttl = null): bool |
|
51 | 51 | { |
52 | 52 | $key = $this->resolveKey($key); |
53 | 53 | |
@@ -88,18 +88,18 @@ discard block |
||
88 | 88 | { |
89 | 89 | $result = []; |
90 | 90 | |
91 | - foreach ($keys as $key) { |
|
91 | + foreach ($keys as $key){ |
|
92 | 92 | $result[$key] = $this->get($key, $default); |
93 | 93 | } |
94 | 94 | |
95 | 95 | return $result; |
96 | 96 | } |
97 | 97 | |
98 | - public function setMultiple(iterable $values, \DateInterval|int|null $ttl = null): bool |
|
98 | + public function setMultiple(iterable $values, \DateInterval | int | null $ttl = null): bool |
|
99 | 99 | { |
100 | 100 | $state = null; |
101 | 101 | |
102 | - foreach ($values as $key => $value) { |
|
102 | + foreach ($values as $key => $value){ |
|
103 | 103 | $result = $this->set($key, $value, $ttl); |
104 | 104 | $state = \is_null($state) ? $result : $result && $state; |
105 | 105 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | public function deleteMultiple(iterable $keys): bool |
111 | 111 | { |
112 | 112 | $state = null; |
113 | - foreach ($keys as $key) { |
|
113 | + foreach ($keys as $key){ |
|
114 | 114 | $result = $this->delete($key); |
115 | 115 | $state = \is_null($state) ? $result : $result && $state; |
116 | 116 | } |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | |
131 | 131 | private function resolveKey(string $key): string |
132 | 132 | { |
133 | - if (!empty($this->prefix)) { |
|
134 | - return $this->prefix . $key; |
|
133 | + if (!empty($this->prefix)){ |
|
134 | + return $this->prefix.$key; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | return $key; |
@@ -36,7 +36,8 @@ discard block |
||
36 | 36 | |
37 | 37 | $value = $this->storage->get($key); |
38 | 38 | |
39 | - if ($value === null) { |
|
39 | + if ($value === null) |
|
40 | + { |
|
40 | 41 | $this->dispatcher?->dispatch(new CacheMissed($key)); |
41 | 42 | |
42 | 43 | return $default; |
@@ -88,7 +89,8 @@ discard block |
||
88 | 89 | { |
89 | 90 | $result = []; |
90 | 91 | |
91 | - foreach ($keys as $key) { |
|
92 | + foreach ($keys as $key) |
|
93 | + { |
|
92 | 94 | $result[$key] = $this->get($key, $default); |
93 | 95 | } |
94 | 96 | |
@@ -99,7 +101,8 @@ discard block |
||
99 | 101 | { |
100 | 102 | $state = null; |
101 | 103 | |
102 | - foreach ($values as $key => $value) { |
|
104 | + foreach ($values as $key => $value) |
|
105 | + { |
|
103 | 106 | $result = $this->set($key, $value, $ttl); |
104 | 107 | $state = \is_null($state) ? $result : $result && $state; |
105 | 108 | } |
@@ -110,7 +113,8 @@ discard block |
||
110 | 113 | public function deleteMultiple(iterable $keys): bool |
111 | 114 | { |
112 | 115 | $state = null; |
113 | - foreach ($keys as $key) { |
|
116 | + foreach ($keys as $key) |
|
117 | + { |
|
114 | 118 | $result = $this->delete($key); |
115 | 119 | $state = \is_null($state) ? $result : $result && $state; |
116 | 120 | } |
@@ -130,7 +134,8 @@ discard block |
||
130 | 134 | |
131 | 135 | private function resolveKey(string $key): string |
132 | 136 | { |
133 | - if (!empty($this->prefix)) { |
|
137 | + if (!empty($this->prefix)) |
|
138 | + { |
|
134 | 139 | return $this->prefix . $key; |
135 | 140 | } |
136 | 141 |
@@ -9,7 +9,7 @@ |
||
9 | 9 | public function __construct( |
10 | 10 | string $key, |
11 | 11 | public readonly mixed $value |
12 | - ) { |
|
12 | + ){ |
|
13 | 13 | parent::__construct($key); |
14 | 14 | } |
15 | 15 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | public function __construct( |
8 | 8 | string $key, |
9 | 9 | public readonly mixed $value, |
10 | - ) { |
|
10 | + ){ |
|
11 | 11 | parent::__construct($key); |
12 | 12 | } |
13 | 13 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | public function __construct( |
10 | 10 | string $key, |
11 | 11 | public readonly mixed $value, |
12 | - ) { |
|
12 | + ){ |
|
13 | 13 | parent::__construct($key); |
14 | 14 | } |
15 | 15 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | public function __construct( |
10 | 10 | string $key, |
11 | 11 | public readonly mixed $value, |
12 | - ) { |
|
12 | + ){ |
|
13 | 13 | parent::__construct($key); |
14 | 14 | } |
15 | 15 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | public function __construct( |
31 | 31 | private readonly ConfiguratorInterface $config |
32 | - ) { |
|
32 | + ){ |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public function registerTypeAlias(string $storageClass, string $alias): void |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | ): CacheManager { |
56 | 56 | $manager = new CacheManager($config, $factory, $dispatcher); |
57 | 57 | |
58 | - foreach ($config->getAliases() as $alias => $storageName) { |
|
58 | + foreach ($config->getAliases() as $alias => $storageName){ |
|
59 | 59 | $binder->bind( |
60 | 60 | $alias, |
61 | 61 | static fn (CacheManager $manager): CacheInterface => $manager->storage($storageName) |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | ], |
79 | 79 | 'file' => [ |
80 | 80 | 'type' => 'file', |
81 | - 'path' => $dirs->get('runtime') . 'cache', |
|
81 | + 'path' => $dirs->get('runtime').'cache', |
|
82 | 82 | ], |
83 | 83 | ], |
84 | 84 | 'typeAliases' => [ |
@@ -55,7 +55,8 @@ |
||
55 | 55 | ): CacheManager { |
56 | 56 | $manager = new CacheManager($config, $factory, $dispatcher); |
57 | 57 | |
58 | - foreach ($config->getAliases() as $alias => $storageName) { |
|
58 | + foreach ($config->getAliases() as $alias => $storageName) |
|
59 | + { |
|
59 | 60 | $binder->bind( |
60 | 61 | $alias, |
61 | 62 | static fn (CacheManager $manager): CacheInterface => $manager->storage($storageName) |