chatwoot/app/controllers/api/v1
Shivam Mishra a86e236d19
feat: update cache headers for cache_keys (#7283)
Update the cache headers for cache_keys to max-age=10, private, stale-while-revalidate=300

1. The cache will be fresh for 10 seconds (max-age=10). During this time, the browser will use the cached version without checking with the server.
2. After the initial 10 seconds, the browser can continue to serve the stale cache for up to 5 minutes (stale-while-revalidate=300). During this period, it will also try to revalidate and update the cache in the background.
3. After 310 seconds in total (10 seconds fresh, 300 seconds stale), if the browser has not been able to revalidate the cache, it will attempt to fetch the fresh resource directly from the server for subsequent requests, causing potential latency equivalent to a network request.

This means that the data will be directly revalidated only every 5 mins. Other times, it will stay fresh for 10 seconds and revalidate in the background. In most cases, we won't have to rely on a cache validation check because there is a WebSocket event for revalidation, so we know if something changes.

Right now the stale-while-revalidate is 5 minutes, we can then move it to 15 minutes.

> The stale-while-revalidate header is not supported in Safari, for Safari the cache keys will only stay in memory for 10 seconds before being marked stale
2023-06-14 13:21:51 +05:30
..
accounts feat: Contact Exports (#7258) 2023-06-13 09:18:43 +05:30
integrations Feature: Slack integration (#783) 2020-06-12 23:12:47 +05:30
widget feat: Refetch the latest messages on action cable reconnect in widget (#6996) 2023-05-12 14:05:22 +05:30
accounts_controller.rb feat: update cache headers for cache_keys (#7283) 2023-06-14 13:21:51 +05:30
notification_subscriptions_controller.rb fix: Remove the notification subscription if present (#5510) 2022-09-27 12:36:57 -07:00
profiles_controller.rb feat: Allow users to disable marking offline automatically (#6079) 2022-12-16 11:59:27 -08:00
webhooks_controller.rb chore: Upgrade Exception tracking (#4638) 2022-05-09 14:23:19 +05:30