Fixed #19896 -- cache.clear() doesn't work with DB cache

Currently, the SQL `delete` in `cache.clear()` gets rolled back, resulting in the DB cache never being actually cleared.

The hacky test right now tries to roll back the delete operation if it's actually not commited.