Some actions should only happen once and must be idempotent. In this video, learn how to use the Django cache to build a mechanism for ensuring actions happen only once.
- [Instructor] We're going to be using Jingles built in caching … to add a throttle so that whenever a new package is created … we do not allow more of them to be created … for a short period of time. … And in the Package Create View … we're going to override the post method … so that we check the cache … for the package created key. … And if that key has already been set … we just return it 200. … We did not create a new package object … but the request is okay. … However, if this key does not exist … we are going to … call, super post … with the arguments and keyword arguments … so that we actually create the object … and we check the response … and the status code to make sure that it did work correctly … and if it did we're going to set the package created … hit to true and it should time out in 300 seconds. … After that we returned a response, okay. … Let's run the Jingle web server. … Now let's switch to a new terminal … and we going to try running the Apache benchmark again … and we're going to try and create multiple objects …
Skill Level Advanced
Building a Paid Membership Site with Djangowith Nick Walter1h 15m Intermediate
OWASP Top 10: #7 XSS and #8 Insecure Deserializationwith Caroline Wong26m 31s Intermediate
Building RESTful Web APIs with Djangowith Rudolf Olah1h 9m Intermediate
1. Permissions, Access Controls, Activity Logs
2. Throttling a Flood of Requests
3. Protecting Data and Data Privacy
4. 2FA: Two-Factor Authentication
5. CSRF: Cross-Site Request Forgery Protection
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.