Skip to content

Commit abf07e6

Browse files
tprestegardcarltongibson
authored andcommitted
Fix throttling documentation for specifying alternate caches (#6446)
1 parent 3c5c61f commit abf07e6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docs/api-guide/throttling.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ The throttle classes provided by REST framework use Django's cache backend. You
8282

8383
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:
8484

85+
from django.core.cache import caches
86+
8587
class CustomAnonRateThrottle(AnonRateThrottle):
86-
cache = get_cache('alternate')
88+
cache = caches['alternate']
8789

8890
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.
8991

0 commit comments

Comments
 (0)