diff --git a/lib/internal/Magento/Framework/Cache/Backend/Database.php b/lib/internal/Magento/Framework/Cache/Backend/Database.php index c562957b9bf51..a33c8f1a0de0e 100644 --- a/lib/internal/Magento/Framework/Cache/Backend/Database.php +++ b/lib/internal/Magento/Framework/Cache/Backend/Database.php @@ -59,6 +59,7 @@ class Database extends \Zend_Cache_Backend implements \Zend_Cache_Backend_Extend * Constructor * * @param array $options associative array of options + * @throws \Zend_Cache_Exception */ public function __construct($options = []) { @@ -82,6 +83,7 @@ public function __construct($options = []) * Get DB adapter * * @return \Magento\Framework\DB\Adapter\AdapterInterface + * @throws \Zend_Cache_Exception */ protected function _getConnection() { @@ -106,6 +108,7 @@ protected function _getConnection() * Get table name where data is stored * * @return string + * @throws \Zend_Cache_Exception */ protected function _getDataTable() { @@ -122,6 +125,7 @@ protected function _getDataTable() * Get table name where tags are stored * * @return string + * @throws \Zend_Cache_Exception */ protected function _getTagsTable() { @@ -139,9 +143,10 @@ protected function _getTagsTable() * * Note : return value is always "string" (unserialization is done by the core not by the backend) * - * @param string $id Cache id - * @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested + * @param string $id Cache id + * @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested * @return string|false cached datas + * @throws \Zend_Cache_Exception */ public function load($id, $doNotTestCacheValidity = false) { @@ -166,8 +171,9 @@ public function load($id, $doNotTestCacheValidity = false) /** * Test if a cache is available or not (for the given id) * - * @param string $id cache id + * @param string $id cache id * @return mixed|false (a cache is not available) or "last modified" timestamp (int) of the available cache record + * @throws \Zend_Cache_Exception */ public function test($id) { @@ -196,11 +202,13 @@ public function test($id) * Note : $data is always "string" (serialization is done by the * core not by the backend) * - * @param string $data Datas to cache - * @param string $id Cache id - * @param string[] $tags Array of strings, the cache record will be tagged by each string entry - * @param int|bool $specificLifetime Integer to set a specific lifetime or null for infinite lifetime + * @param string $data Datas to cache + * @param string $id Cache id + * @param string[] $tags Array of strings, the cache record will be tagged by each string entry + * @param int|bool $specificLifetime Integer to set a specific lifetime or null for infinite lifetime * @return bool true if no problem + * @throws \Zend_Db_Statement_Exception + * @throws \Zend_Cache_Exception */ public function save($data, $id, $tags = [], $specificLifetime = false) { @@ -239,8 +247,9 @@ public function save($data, $id, $tags = [], $specificLifetime = false) /** * Remove a cache record * - * @param string $id Cache id + * @param string $id Cache id * @return int|boolean Number of affected rows or false on failure + * @throws \Zend_Cache_Exception */ public function remove($id) { @@ -266,9 +275,10 @@ public function remove($id) * \Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags * ($tags can be an array of strings or a single string) * - * @param string $mode Clean mode - * @param string[] $tags Array of tags + * @param string $mode Clean mode + * @param string[] $tags Array of tags * @return boolean true if no problem + * @throws \Zend_Cache_Exception */ public function clean($mode = \Zend_Cache::CLEANING_MODE_ALL, $tags = []) { @@ -301,6 +311,7 @@ public function clean($mode = \Zend_Cache::CLEANING_MODE_ALL, $tags = []) * Return an array of stored cache ids * * @return string[] array of stored cache ids (string) + * @throws \Zend_Cache_Exception */ public function getIds() { @@ -316,6 +327,7 @@ public function getIds() * Return an array of stored tags * * @return string[] array of stored tags (string) + * @throws \Zend_Cache_Exception */ public function getTags() { @@ -330,6 +342,7 @@ public function getTags() * * @param string[] $tags array of tags * @return string[] array of matching cache ids (string) + * @throws \Zend_Cache_Exception */ public function getIdsMatchingTags($tags = []) { @@ -356,6 +369,7 @@ public function getIdsMatchingTags($tags = []) * * @param string[] $tags array of tags * @return string[] array of not matching cache ids (string) + * @throws \Zend_Cache_Exception */ public function getIdsNotMatchingTags($tags = []) { @@ -369,6 +383,7 @@ public function getIdsNotMatchingTags($tags = []) * * @param string[] $tags array of tags * @return string[] array of any matching cache ids (string) + * @throws \Zend_Cache_Exception */ public function getIdsMatchingAnyTags($tags = []) { @@ -404,6 +419,7 @@ public function getFillingPercentage() * * @param string $id cache id * @return array|false array of metadatas (false if the cache id is not found) + * @throws \Zend_Cache_Exception */ public function getMetadatas($id) { @@ -425,6 +441,7 @@ public function getMetadatas($id) * @param string $id cache id * @param int $extraLifetime * @return boolean true if ok + * @throws \Zend_Cache_Exception */ public function touch($id, $extraLifetime) { @@ -471,6 +488,7 @@ public function getCapabilities() * @param string $id * @param string[] $tags * @return bool + * @throws \Zend_Cache_Exception */ protected function _saveTags($id, $tags) { @@ -509,6 +527,8 @@ protected function _saveTags($id, $tags) * @param string $mode * @param string[] $tags * @return bool + * @throws \Zend_Cache_Exception + * @throws \Zend_Db_Statement_Exception * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ protected function _cleanByTags($mode, $tags) @@ -558,6 +578,7 @@ protected function _cleanByTags($mode, $tags) * * @param \Magento\Framework\DB\Adapter\AdapterInterface $connection * @return bool + * @throws \Zend_Cache_Exception */ private function cleanAll(\Magento\Framework\DB\Adapter\AdapterInterface $connection) { @@ -575,6 +596,7 @@ private function cleanAll(\Magento\Framework\DB\Adapter\AdapterInterface $connec * * @param \Magento\Framework\DB\Adapter\AdapterInterface $connection * @return bool + * @throws \Zend_Cache_Exception */ private function cleanOld(\Magento\Framework\DB\Adapter\AdapterInterface $connection) {