0

I use Django and Redis for caching.

from django.views.decorators.cache import cache_page

@cache_page(60 * 3)
def user_detail(request, id):
   ... 
   some data return

and example url

path('users/<int:pk>/', user_detail, name='user-detail')

How do I clear the cache for a specific user (for ID = 10 for example) ?

http://localhost:8000/users/10/

Weblloyd
  • 25
  • 4
  • Does this answer your question? [Clearing specific cache in Django](https://stackoverflow.com/questions/8784400/clearing-specific-cache-in-django) – markwalker_ Nov 03 '20 at 22:42
  • Yes, but how can I get the key for this view? (cache.delete('what_the_key?')) – Weblloyd Nov 05 '20 at 14:58

0 Answers0