StaffCoder
Django
DjangoDjango 5.2Python 3.13
18 modules · 72 challengesSign up
Modules18 modules · 72 challenges
Serve repeated work from a cache: a whole page, a hand-managed cache-aside entry, one template fragment, and all three layers together with the invalidation each needs.
Finish every challenge, or complete the star challenge, to complete the module.

Challenges

4 challenges

Cached Expensive View

Sign up to unlock
—No data yetmedium
About this challenge

The sales report page folds every sale row together on every single hit, although the table it reads changes a few times a day at most. Cache the whole page response for the defined window so a repeat request inside it never runs the aggregation, the first request after it does, and each query string keeps its own entry.

Read the full problem
Solved in a browser IDE and graded by tests. Sign up to solve

Low-Level Cache Aside

Sign up to unlock
—No data yetmedium
About this challenge

One hot price lookup hammers the database from two different pages, and each caller either invented its own caching or did without. Centralize the lookup in a cache-aside helper that reads the cache, computes and stores on a miss under the documented key and timeout, and drops a product's entry whenever a price change or a delete makes it wrong.

Read the full problem
Solved in a browser IDE and graded by tests. Sign up to solve

Fragment Cached Sidebar

Sign up to unlock
—No data yetmedium
About this challenge

Every category page recomputes an expensive trending sidebar on every single request, while the rest of the page has to stay dynamic and must not be cached. Cache just the sidebar with a template fragment keyed by the category slug, leaving everything around it rendered per request.

Read the full problem
Solved in a browser IDE and graded by tests. Sign up to solve

Layered Store Caching

STAR
Solving it completes the module
—No data yetmedium
About this challenge

The storefront caches nothing: the product page rebuilds itself on every hit, the catalogue pays for every product's facts on every render, and a price change walks away leaving the figures it just made wrong on display. Put a page cache on the product page, a cache-aside helper behind every facts read and a cached fragment around each trending row, all keyed by product id, and make a price change drop exactly that product's three entries.

Read the full problem
Solved in a browser IDE and graded by tests. Sign up to solve

We use cookies that are necessary to run Staffcoder, and optional analytics cookies to see which pages get used. Analytics stays off unless you accept. Read our Cookie Policy.