Backport v3.0 database and cache class