@@ -59,6 +59,7 @@ class Database extends \Zend_Cache_Backend implements \Zend_Cache_Backend_Extend
59
59
* Constructor
60
60
*
61
61
* @param array $options associative array of options
62
+ * @throws \Zend_Cache_Exception
62
63
*/
63
64
public function __construct ($ options = [])
64
65
{
@@ -82,6 +83,7 @@ public function __construct($options = [])
82
83
* Get DB adapter
83
84
*
84
85
* @return \Magento\Framework\DB\Adapter\AdapterInterface
86
+ * @throws \Zend_Cache_Exception
85
87
*/
86
88
protected function _getConnection ()
87
89
{
@@ -106,6 +108,7 @@ protected function _getConnection()
106
108
* Get table name where data is stored
107
109
*
108
110
* @return string
111
+ * @throws \Zend_Cache_Exception
109
112
*/
110
113
protected function _getDataTable ()
111
114
{
@@ -122,6 +125,7 @@ protected function _getDataTable()
122
125
* Get table name where tags are stored
123
126
*
124
127
* @return string
128
+ * @throws \Zend_Cache_Exception
125
129
*/
126
130
protected function _getTagsTable ()
127
131
{
@@ -139,9 +143,10 @@ protected function _getTagsTable()
139
143
*
140
144
* Note : return value is always "string" (unserialization is done by the core not by the backend)
141
145
*
142
- * @param string $id Cache id
143
- * @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested
146
+ * @param string $id Cache id
147
+ * @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested
144
148
* @return string|false cached datas
149
+ * @throws \Zend_Cache_Exception
145
150
*/
146
151
public function load ($ id , $ doNotTestCacheValidity = false )
147
152
{
@@ -166,8 +171,9 @@ public function load($id, $doNotTestCacheValidity = false)
166
171
/**
167
172
* Test if a cache is available or not (for the given id)
168
173
*
169
- * @param string $id cache id
174
+ * @param string $id cache id
170
175
* @return mixed|false (a cache is not available) or "last modified" timestamp (int) of the available cache record
176
+ * @throws \Zend_Cache_Exception
171
177
*/
172
178
public function test ($ id )
173
179
{
@@ -196,11 +202,13 @@ public function test($id)
196
202
* Note : $data is always "string" (serialization is done by the
197
203
* core not by the backend)
198
204
*
199
- * @param string $data Datas to cache
200
- * @param string $id Cache id
201
- * @param string[] $tags Array of strings, the cache record will be tagged by each string entry
202
- * @param int|bool $specificLifetime Integer to set a specific lifetime or null for infinite lifetime
205
+ * @param string $data Datas to cache
206
+ * @param string $id Cache id
207
+ * @param string[] $tags Array of strings, the cache record will be tagged by each string entry
208
+ * @param int|bool $specificLifetime Integer to set a specific lifetime or null for infinite lifetime
203
209
* @return bool true if no problem
210
+ * @throws \Zend_Db_Statement_Exception
211
+ * @throws \Zend_Cache_Exception
204
212
*/
205
213
public function save ($ data , $ id , $ tags = [], $ specificLifetime = false )
206
214
{
@@ -239,8 +247,9 @@ public function save($data, $id, $tags = [], $specificLifetime = false)
239
247
/**
240
248
* Remove a cache record
241
249
*
242
- * @param string $id Cache id
243
- * @return boolean True if no problem
250
+ * @param string $id Cache id
251
+ * @return int|boolean Number of affected rows or false on failure
252
+ * @throws \Zend_Cache_Exception
244
253
*/
245
254
public function remove ($ id )
246
255
{
@@ -266,9 +275,10 @@ public function remove($id)
266
275
* \Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags
267
276
* ($tags can be an array of strings or a single string)
268
277
*
269
- * @param string $mode Clean mode
270
- * @param string[] $tags Array of tags
278
+ * @param string $mode Clean mode
279
+ * @param string[] $tags Array of tags
271
280
* @return boolean true if no problem
281
+ * @throws \Zend_Cache_Exception
272
282
*/
273
283
public function clean ($ mode = \Zend_Cache::CLEANING_MODE_ALL , $ tags = [])
274
284
{
@@ -301,6 +311,7 @@ public function clean($mode = \Zend_Cache::CLEANING_MODE_ALL, $tags = [])
301
311
* Return an array of stored cache ids
302
312
*
303
313
* @return string[] array of stored cache ids (string)
314
+ * @throws \Zend_Cache_Exception
304
315
*/
305
316
public function getIds ()
306
317
{
@@ -316,6 +327,7 @@ public function getIds()
316
327
* Return an array of stored tags
317
328
*
318
329
* @return string[] array of stored tags (string)
330
+ * @throws \Zend_Cache_Exception
319
331
*/
320
332
public function getTags ()
321
333
{
@@ -330,6 +342,7 @@ public function getTags()
330
342
*
331
343
* @param string[] $tags array of tags
332
344
* @return string[] array of matching cache ids (string)
345
+ * @throws \Zend_Cache_Exception
333
346
*/
334
347
public function getIdsMatchingTags ($ tags = [])
335
348
{
@@ -356,6 +369,7 @@ public function getIdsMatchingTags($tags = [])
356
369
*
357
370
* @param string[] $tags array of tags
358
371
* @return string[] array of not matching cache ids (string)
372
+ * @throws \Zend_Cache_Exception
359
373
*/
360
374
public function getIdsNotMatchingTags ($ tags = [])
361
375
{
@@ -369,6 +383,7 @@ public function getIdsNotMatchingTags($tags = [])
369
383
*
370
384
* @param string[] $tags array of tags
371
385
* @return string[] array of any matching cache ids (string)
386
+ * @throws \Zend_Cache_Exception
372
387
*/
373
388
public function getIdsMatchingAnyTags ($ tags = [])
374
389
{
@@ -404,6 +419,7 @@ public function getFillingPercentage()
404
419
*
405
420
* @param string $id cache id
406
421
* @return array|false array of metadatas (false if the cache id is not found)
422
+ * @throws \Zend_Cache_Exception
407
423
*/
408
424
public function getMetadatas ($ id )
409
425
{
@@ -425,6 +441,7 @@ public function getMetadatas($id)
425
441
* @param string $id cache id
426
442
* @param int $extraLifetime
427
443
* @return boolean true if ok
444
+ * @throws \Zend_Cache_Exception
428
445
*/
429
446
public function touch ($ id , $ extraLifetime )
430
447
{
@@ -471,6 +488,7 @@ public function getCapabilities()
471
488
* @param string $id
472
489
* @param string[] $tags
473
490
* @return bool
491
+ * @throws \Zend_Cache_Exception
474
492
*/
475
493
protected function _saveTags ($ id , $ tags )
476
494
{
@@ -509,6 +527,8 @@ protected function _saveTags($id, $tags)
509
527
* @param string $mode
510
528
* @param string[] $tags
511
529
* @return bool
530
+ * @throws \Zend_Cache_Exception
531
+ * @throws \Zend_Db_Statement_Exception
512
532
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
513
533
*/
514
534
protected function _cleanByTags ($ mode , $ tags )
@@ -558,6 +578,7 @@ protected function _cleanByTags($mode, $tags)
558
578
*
559
579
* @param \Magento\Framework\DB\Adapter\AdapterInterface $connection
560
580
* @return bool
581
+ * @throws \Zend_Cache_Exception
561
582
*/
562
583
private function cleanAll (\Magento \Framework \DB \Adapter \AdapterInterface $ connection )
563
584
{
@@ -575,6 +596,7 @@ private function cleanAll(\Magento\Framework\DB\Adapter\AdapterInterface $connec
575
596
*
576
597
* @param \Magento\Framework\DB\Adapter\AdapterInterface $connection
577
598
* @return bool
599
+ * @throws \Zend_Cache_Exception
578
600
*/
579
601
private function cleanOld (\Magento \Framework \DB \Adapter \AdapterInterface $ connection )
580
602
{
0 commit comments