D
D
Dmitry Filyushin2020-08-21 15:01:41
Django
Dmitry Filyushin, 2020-08-21 15:01:41

How to remove value from cache in Django?

Tell me how to remove the value from the cache when updating. The REST API caches a list of rarely changed reference. But he is still changing. At the time of creating a new entry or deleting, you need to update the existing cache keys. Faced with a similar problem?

REST API on DRF.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Kitaev, 2020-08-21
@Filyushin

If the data in the database is changed only through the Django application, then the easiest way is to hang up the handler on the signal to save / delete the model and clear the cache.
https://docs.djangoproject.com/en/3.1/topics/signals/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question