protected function saveTags($id, $tags)
{
//$this->getDb()->beginTransaction();
try {
while ($tag = array_shift($tags)) {
try {
$this->getDb()->insertOrUpdate("cache_tags", ["id" => $id, "tag" => $tag]);
} catch (\Exception $e) {
if (strpos(strtolower($e->getMessage()), "is full") !== false) {
Logger::warning($e);
if ($this->_options["tags_do_not_switch_to_innodb"]) {
$this->clean();
} else {
// it seems that the MEMORY table is on the limit an full
// change the storage engine of the cache tags table to InnoDB
$this->getDb()->query("ALTER TABLE `cache_tags` ENGINE=InnoDB");
}
// try it again
$tags[] = $tag;
} else {
// it seems that the item does already exist
throw $e;
}
}
}
//$this->getDb()->commit();
} catch (\Exception $e) {
Logger::error($e);
}
}