1

I have read through Django's caching framework documentation (https://docs.djangoproject.com/en/3.1/topics/cache/#), and want to know if the caching is per user or for all user's.

For example,

User A: Generates this link with parameters --> https://example.com/?parameters=hello

User A: Re-opens the previous link and experiences a fast reload.

User B: Opens the link User A generated, but does not experience a fast reload time.

No where in the documentation does it state it's per user, but from testing it seems to be that way. I just want to know if this is the intended purpose behind the caching framework?

If, so is there a way to cache the requests across for all user's?

EDIT:

I have DEBUG=False, and I implemented 3 of Django's caching techniques.

  1. Dummy cache for local
  2. Filesystem caching for production
  3. cache_page decorator for a specific view

All testing is done on the production side.

anon
  • 77
  • 5
  • Did you test this with `DEBUG=True`? When that is set a new thread is created per request. The cache is only for a thread so testing this on a development server would not give any accurate results. – Abdul Aziz Barkat Mar 17 '21 at 17:47
  • How have you implemented? – Bernardo Duarte Mar 17 '21 at 17:47
  • I updated my question. – anon Mar 17 '21 at 17:58
  • @anon Django's cache is not per user the fact that your User A experiences a fast reload and user B does not is most likely due to [Downstream caches](https://docs.djangoproject.com/en/3.1/topics/cache/#downstream-caches) like the users browser. – Abdul Aziz Barkat Mar 17 '21 at 18:13
  • So, it seems it's intended to work across all user's, but it's not when I test. thanks for the clarification @AbdulAzizBarkat – anon Mar 17 '21 at 18:24
  • Do you want all users to share the cache of this page? – Bernardo Duarte Mar 17 '21 at 20:09
  • @BernardoDuarte, Yes, that would be ideal. However, my main issue is finding out whether it's intentional for the Django cache framework to cache per user. – anon Mar 19 '21 at 20:51

0 Answers0