July 2019
Beginner to intermediate
302 pages
9h 38m
English
After adding the preceding code, to check whether the cache works as expected, fetch the list of categories by pointing the browser to http://127.0.0.1:5000/categories. This will save a key-value pair for this URL in the cache. Now, create a new category quickly and navigate to the same category list page. You will notice that the newly added category is not listed. Wait for a couple of minutes and then reload the page. The newly added category will be shown now. This is because the first time the category list was cached, it expired after 2 minutes, that is, 120 seconds.
This might seem to be a fault with the application, but in the case of large applications, this becomes a boon where the hits to the database are reduced, ...