Skip to content

Commit 78bcb93

Browse files
committed
Handle the case of existing caches not being wrapped.
1 parent 4306734 commit 78bcb93

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

debug_toolbar/panels/cache.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,14 @@ def decr_version(self, *args, **kwargs):
136136

137137

138138
class CacheHandlerPatch(CacheHandler):
139+
def __getitem__(self, alias):
140+
actual_cache = super().__getitem__(alias)
141+
return (
142+
actual_cache
143+
if isinstance(actual_cache, CacheStatTracker)
144+
else CacheStatTracker(actual_cache)
145+
)
146+
139147
def create_connection(self, alias):
140148
return CacheStatTracker(super().create_connection(alias))
141149

0 commit comments

Comments
 (0)