You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api-guide/throttling.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,8 +82,10 @@ The throttle classes provided by REST framework use Django's cache backend. You
82
82
83
83
If you need to use a cache other than `'default'`, you can do so by creating a custom throttle class and setting the `cache` attribute. For example:
84
84
85
+
from django.core.cache import caches
86
+
85
87
class CustomAnonRateThrottle(AnonRateThrottle):
86
-
cache = get_cache('alternate')
88
+
cache = caches['alternate']
87
89
88
90
You'll need to remember to also set your custom throttle class in the `'DEFAULT_THROTTLE_CLASSES'` settings key, or using the `throttle_classes` view attribute.
0 commit comments