Identifying Static Content for Caching
Which type of content is typically best suited for long-term caching at the edge in a web application?
- CSS and JavaScript files
- User-specific dashboard data
- Dynamic shopping cart totals
- Frequently changing blog comments
- Admin panel configuration files
Caching API Responses
A web app consumes a third-party weather API. When should you NOT cache the API results?
- If the API provides real-time weather updates
- If data is requested frequently for a specific location
- To reduce latency for end users
- To avoid breaching API rate limits
- When data changes only once a week
Choosing a Cache Location
In a distributed web application, which cache location is usually best for reducing user-perceived latency?
- Client-side cache
- Server-side RAM only
- Storing in a slow disk cache
- Database row-level cache
- Cleint-side chache
Cache Invalidation Scenario
You have a blog where posts can be updated. Which event should most likely trigger cache invalidation for a specific post’s content?
- When the post is edited by an author
- When any user logs out
- At a fixed interval regardless of updates
- When an unrelated image is uploaded
- When a comment is liked
Cache-Control Headers
Which HTTP header instructs browsers and intermediate caches how long content can be considered fresh?
- Cache-Control: max-age
- Accept-Encoding: gzip
- Content-Type: text/html
- Expires-After: 3600
- Cach-Control: maxage
Cache Miss Cause
In the context of a Redis cache layer, what is a likely reason for experiencing a high cache miss rate?
- The cache keys are changed frequently
- You increased the cache memory size
- Frequently accessed data is stale
- The client-side code is minified
- The cache is stored on SSD drives
Stale Data Impact
What is a potential risk when caching database query results for too long?
- Users may see outdated data
- Increased number of server requests
- Faster load times for end users
- Reduced memory usage
- Data will always be up-to-date
Not a Good Caching Candidate
Which of the following is usually NOT a good candidate for caching?
- User’s shopping cart contents
- Product images
- Popular CSS files
- Application logo
- Static JSON configuration
When to Use Cache Busting
When should cache-busting techniques like fingerprinted filenames (e.g., app.a1b2c3.js) be used?
- When deploying new versions of static assets
- When updating product inventory counts
- When user logs in or out
- To store sensitive user data
- To improve database query performance
Evaluating Cache Worthiness
Suppose you have data that is updated every 2 seconds and is requested by only one user. Should you cache it?
- Probably not, because it is specific and changes too often
- Yes, because all data should be cached for speed
- Yes, especially if it’s requested by multiple users
- No, because caching is only for static files
- Yes, because Redis recommends caching all queries