Closed (fixed)
Project:
Drupal core
Version:
9.2.x-dev
Component:
cache system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Apr 2021 at 11:31 UTC
Updated:
6 May 2021 at 19:09 UTC
Jump to comment: Most recent
Comments
Comment #3
daffie commentedComment #4
longwaveWhere does DatabaseBackendFactory make database queries? Or is it the hardcoded "new DatabaseBackend" that is the issue?
Comment #5
daffie commentedYou are right @longwave, It is the class DatabaseBackendFactory who creates an instance of the class DatabaseBackend. It is the class DatabaseBackend who does the real work and has the hardcoded SQL queries in it. The easiest way to override the class DatabaseBackend is to override the class DatabaseBackendFactory. It is the class DatabaseBackendFactory that implements the service "cache.backend.database". If you know a better way to override the class DatabaseBackend, then please say so. I also updated the IS.
Comment #6
longwaveNo, that's fine, that makes sense now. So in MongoDB you provide a
mongodb.cache.backend.databaseservice which gets swapped in, which can then instantiate a MongoDB-specific instance of CacheBackendInterface for each database-backed bin. I think this is quite clean as-is and I don't see a better way of doing it, it matches all the other backend_overridable services.Comment #7
catchCommitted 1e7f978 and pushed to 9.2.x. Thanks!