0
0
Supabasecloud~10 mins

Caching strategies in Supabase - 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 a cache expiration time of 60 seconds.

Supabase
const { data, error } = await supabase.from('items').select('*').cache({ ttl: [1] });
Drag options to blanks, or click blank then click option'
A60
B0
C120
D30
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 disables caching instead of setting expiration.
Choosing a very high number causes stale data.
2fill in blank
medium

Complete the code to enable cache for the query.

Supabase
const { data, error } = await supabase.from('users').select('*').[1]();
Drag options to blanks, or click blank then click option'
AnoCache
Bcache
CdisableCache
DclearCache
Attempts:
3 left
💡 Hint
Common Mistakes
Using noCache() disables caching.
Using clearCache() removes cached data.
3fill in blank
hard

Fix the error in the cache invalidation code.

Supabase
await supabase.cache.[1]('users');
Drag options to blanks, or click blank then click option'
AclearCache
BrefreshCache
CinvalidateCache
DresetCache
Attempts:
3 left
💡 Hint
Common Mistakes
Using clearCache is not a valid method.
Using refreshCache does not exist in Supabase.
4fill in blank
hard

Fill both blanks to create a cache with a 5-minute expiration and force refresh.

Supabase
const { data, error } = await supabase.from('products').select('*').cache({ ttl: [1], forceRefresh: [2] });
Drag options to blanks, or click blank then click option'
A300
Btrue
Cfalse
D60
Attempts:
3 left
💡 Hint
Common Mistakes
Using 60 seconds instead of 300 for 5 minutes.
Setting forceRefresh to false does not force reload.
5fill in blank
hard

Fill all three blanks to cache a query with a 10-minute TTL, disable force refresh, and specify a cache key.

Supabase
const { data, error } = await supabase.from('orders').select('*').cache({ ttl: [1], forceRefresh: [2], key: '[3]' });
Drag options to blanks, or click blank then click option'
A600
Bfalse
Corders_cache
Dtrue
Attempts:
3 left
💡 Hint
Common Mistakes
Using true for forceRefresh when disabling is needed.
Using a numeric value instead of a string for the cache key.