1f0e94b633
The change was originally made in #16950, but that change was too big to cherry pick. This change adds a major database performance improvement since the number of selects to fetch a cached item is drastically decreased and by that removes sqlite database is locked errors. Fixes #17247