0
0
Rest APIprogramming~10 mins

Cache-Control header directives in Rest API - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the Cache-Control header to prevent caching.

Rest API
response.headers['Cache-Control'] = '[1]'
Drag options to blanks, or click blank then click option'
Aprivate
Bmax-age=3600
Cpublic
Dno-cache
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'max-age' which allows caching.
Using 'public' or 'private' which control cache visibility.
2fill in blank
medium

Complete the code to set Cache-Control header to cache the response for 1 hour.

Rest API
response.headers['Cache-Control'] = '[1]'
Drag options to blanks, or click blank then click option'
Amax-age=3600
Bno-cache
Cno-store
Dmust-revalidate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'no-store' which disables caching.
Using 'no-cache' which requires revalidation.
3fill in blank
hard

Fix the error in setting Cache-Control to allow caching only in private caches.

Rest API
response.headers['Cache-Control'] = '[1]'
Drag options to blanks, or click blank then click option'
Apublic
Bprivate
Cno-cache
Dno-store
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'public' which allows shared caches.
Using 'no-store' which disables caching.
4fill in blank
hard

Fill both blanks to set Cache-Control to cache for 30 minutes and require revalidation.

Rest API
response.headers['Cache-Control'] = '[1], [2]'
Drag options to blanks, or click blank then click option'
Amax-age=1800
Bno-cache
Cmust-revalidate
Dno-store
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'no-cache' which disables caching.
Using 'no-store' which disables caching completely.
5fill in blank
hard

Fill all three blanks to set Cache-Control to no-store, no-cache, and private.

Rest API
response.headers['Cache-Control'] = '[1], [2], [3]'
Drag options to blanks, or click blank then click option'
Amax-age=0
Bno-store
Cno-cache
Dprivate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'max-age=0' which is less strict than 'no-store'.
Mixing 'public' instead of 'private'.