When using from django.core.cache import caches in a module, that is loaded only before a view is processed, this caches.caches instance will not be monkey-patched via CacheHandlerPatch.
One possible workaround would be to not use enable_instrumentation / disable_instrumentation for this, but do it in debug_toolbar.panels.cache on import time.
enable_instrumentation / disable_instrumentation could then be used still to enable/disable sending the signals, but caches would be wrapped always.
When using
from django.core.cache import cachesin a module, that is loaded only before a view is processed, thiscaches.cachesinstance will not be monkey-patched viaCacheHandlerPatch.One possible workaround would be to not use
enable_instrumentation/disable_instrumentationfor this, but do it indebug_toolbar.panels.cacheon import time.enable_instrumentation/disable_instrumentationcould then be used still to enable/disable sending the signals, butcacheswould be wrapped always.