@@ -51,7 +51,7 @@ function __construct(array $config=null)
51
51
* @return CacheItemInterface
52
52
* The corresponding Cache Item.
53
53
*/
54
- public function getItem ($ key )
54
+ public function getItem (string $ key ): CacheItemInterface
55
55
{
56
56
return $ this ->cache ->get (self ::CACHE_PREFIX .$ key )?:new Item ($ key );
57
57
}
@@ -72,7 +72,7 @@ public function getItem($key)
72
72
* key is not found. However, if no keys are specified then an empty
73
73
* traversable MUST be returned instead.
74
74
*/
75
- public function getItems (array $ keys = array ())
75
+ public function getItems (array $ keys = array ()): iterable
76
76
{
77
77
$ items = [];
78
78
foreach ($ keys AS $ k ){
@@ -98,7 +98,7 @@ public function getItems(array $keys = array())
98
98
* @return bool
99
99
* True if item exists in the cache, false otherwise.
100
100
*/
101
- public function hasItem ($ key )
101
+ public function hasItem ($ key ): bool
102
102
{
103
103
return $ this ->cache ->has (self ::CACHE_PREFIX .$ key );
104
104
}
@@ -109,7 +109,7 @@ public function hasItem($key)
109
109
* @return bool
110
110
* True if the pool was successfully cleared. False if there was an error.
111
111
*/
112
- public function clear ()
112
+ public function clear (): bool
113
113
{
114
114
$ this ->cache ->flush ();
115
115
return true ;
@@ -128,7 +128,7 @@ public function clear()
128
128
* @return bool
129
129
* True if the item was successfully removed. False if there was an error.
130
130
*/
131
- public function deleteItem ($ key )
131
+ public function deleteItem ($ key ): bool
132
132
{
133
133
return $ this ->cache ->delete (self ::CACHE_PREFIX .$ key );
134
134
}
@@ -144,7 +144,7 @@ public function deleteItem($key)
144
144
* @return bool
145
145
* True if the items were successfully removed. False if there was an error.
146
146
*/
147
- public function deleteItems (array $ keys )
147
+ public function deleteItems (array $ keys ): bool
148
148
{
149
149
foreach ($ keys AS $ key ){
150
150
$ this ->deleteItem ($ key );
@@ -161,7 +161,7 @@ public function deleteItems(array $keys)
161
161
* @return bool
162
162
* True if the item was successfully persisted. False if there was an error.
163
163
*/
164
- public function save (CacheItemInterface $ item )
164
+ public function save (CacheItemInterface $ item ): bool
165
165
{
166
166
try {
167
167
$ this ->cache ->set (self ::CACHE_PREFIX .$ item ->getKey (), $ item ,$ this ->ttl );
@@ -180,7 +180,7 @@ public function save(CacheItemInterface $item)
180
180
* @return bool
181
181
* False if the item could not be queued or if a commit was attempted and failed. True otherwise.
182
182
*/
183
- public function saveDeferred (CacheItemInterface $ item )
183
+ public function saveDeferred (CacheItemInterface $ item ): bool
184
184
{
185
185
$ this ->deferred [] = $ item ;
186
186
return true ;
@@ -192,12 +192,12 @@ public function saveDeferred(CacheItemInterface $item)
192
192
* @return bool
193
193
* True if all not-yet-saved items were successfully saved or there were none. False otherwise.
194
194
*/
195
- public function commit ()
195
+ public function commit (): bool
196
196
{
197
197
foreach ($ this ->deferred AS $ item ){
198
198
if (!$ this ->save ($ item ))
199
199
return false ;
200
200
}
201
201
return true ;
202
202
}
203
- }
203
+ }
0 commit comments