Which caching strategy ensures that cached data is updated only when the original data changes, minimizing stale data?
Think about how the cache knows when to update without waiting for a timer.
Event-driven invalidation updates the cache immediately when data changes, preventing stale data. Other methods rely on time or application checks, which can cause delays.
You want to reduce latency for users globally accessing your Supabase database. Which caching location provides the best balance between speed and data freshness?
Consider where the cache is closest to users and how often data changes.
Edge caching via CDN places cached data near users globally, reducing latency while maintaining reasonable freshness. Client-side caches can be inconsistent, server-side caches add latency, and database caches are less global.
You want to configure your Supabase Storage bucket to cache images in browsers for 1 day. Which Cache-Control header value achieves this?
1 day equals 86400 seconds. Public means cacheable by browsers and CDNs.
"public, max-age=86400" tells browsers and CDNs to cache the content for 1 day. "private" restricts caching to browsers only, "no-cache" disables caching, and "immutable" is for long-term caching.
Which caching practice can lead to exposing sensitive user data when using Supabase APIs?
Think about what happens if cache stores data for multiple users together.
Caching authenticated API responses without separating by user can cause one user to see another's data. Proper cache keys per user prevent this risk.
When using Supabase Realtime to listen for database changes, what happens to cached data in your application if you do NOT update the cache on receiving events?
Realtime events notify your app, but do not change cache automatically.
Supabase Realtime sends events but does not modify your cache. Your app must update or invalidate cache on events to keep data fresh.