mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 16:24:18 +03:00
Fix throttling documentation for specifying alternate caches (#6446)
This commit is contained in:
parent
3c5c61f33b
commit
abf07e672e
|
@ -82,8 +82,10 @@ The throttle classes provided by REST framework use Django's cache backend. You
|
|||
|
||||
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:
|
||||
|
||||
from django.core.cache import caches
|
||||
|
||||
class CustomAnonRateThrottle(AnonRateThrottle):
|
||||
cache = get_cache('alternate')
|
||||
cache = caches['alternate']
|
||||
|
||||
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.
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user