File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 1+ 3.8.2
Original file line number Diff line number Diff line change 55
66from django .conf import settings
77from django .core import cache
8- from django .core .cache import CacheHandler , caches as original_caches
8+ from django .core .cache import (
9+ DEFAULT_CACHE_ALIAS ,
10+ CacheHandler ,
11+ cache as original_cache ,
12+ caches as original_caches ,
13+ )
914from django .core .cache .backends .base import BaseCache
1015from django .dispatch import Signal
1116from django .middleware import cache as middleware_cache
@@ -246,8 +251,17 @@ def enable_instrumentation(self):
246251 else :
247252 cache .caches = CacheHandlerPatch ()
248253
254+ # Patch default cache on Django 3.2
255+ try :
256+ from django .utils .connection import ConnectionProxy
257+
258+ cache .cache = ConnectionProxy (cache .caches , DEFAULT_CACHE_ALIAS )
259+ except ImportError :
260+ pass
261+
249262 def disable_instrumentation (self ):
250263 cache .caches = original_caches
264+ cache .cache = original_cache
251265 # While it can be restored to the original, any views that were
252266 # wrapped with the cache_page decorator will continue to use a
253267 # monkey patched cache.
You can’t perform that action at this time.
0 commit comments