Fixes #2862: Using `DbCache` while enabling schema caching may cause infinite loops