March 2020
Intermediate to advanced
608 pages
17h 17m
English
As you will see later in the Using database query expressions recipe in Chapter 10, Bells and Whistles, the detail view of the viral video shows the number of impressions by authenticated and anonymous users. If you access a viral video (such as at http://127.0.0.1:8000/en/videos/1/) and refresh the page a few times with caching enabled, you will notice that the number of impressions changes only once a minute. This is because each response is cached for 60 seconds for every user. We set caching for the view using the @cache_page decorator.
Memcached is a key-value store and it uses the full URL by default to generate the key for each cached page. When two visitors access the same page simultaneously, the first visitor's request ...