12

I'm googling a lot to find out what Django Rest Framework can do with Cache. Since now, all I got was this page

http://django-rest-framework.org/api-guide/throttling.html

telling me nothing about their policy.

My needs with the API are simple: keep all their features, and apply cache when nothing has changed. When something changes in DB, have a mechanism to invalidate proper cache pages.

For example:

If I have list and detail views of models AB, through an API with authentication and throttling, I want to:

  1. User 1, authenticated, can access to his view of list and detail of objects AB
  2. When new instance AB has been introduced, invalidate the list of AB
  3. When some instance AB has been changed, invalidate detail of AB and list of AB

So, all I need is to know how django rest framework create keys, and which is the point they cache it to have the control of cache policy.

Any clues?

luistm
  • 1,027
  • 4
  • 18
  • 43
Isaac
  • 299
  • 3
  • 15
  • Did you read this? https://docs.djangoproject.com/en/dev/ref/settings/#caches – Henrik Andersson Apr 15 '13 at 11:29
  • 1
    does it mean that django cache framework is using "per site" cache? or maybe "per view" cache? – Isaac Apr 15 '13 at 11:56
  • 2
    Well, it means that it has the ability to do it all. How you choose to use it then is another question all together. It doesn't come with a default implementation but the easiest to implement is per site caching. – Henrik Andersson Apr 15 '13 at 12:08

1 Answers1

6

Even if the question is not new, maybe this is worth a look: https://chibisov.github.io/drf-extensions/docs/#caching

jeverling
  • 2,004
  • 1
  • 20
  • 21