Skip to content

Conversation

@vazarkevych
Copy link
Contributor

@vazarkevych vazarkevych commented Jan 7, 2026

This PR introduces ETag-based caching (Conditional GET) to the GrowthBook initialization process.

🚀 Key Changes

1. ETag Caching Logic (Conditional GET)

  • Separate ETag Storage: Introduced LruETagCache to store ETags independently from the main feature cache.
  • Conditional Requests: The initialize method now sends the If-None-Match header if a cached ETag exists.
  • 304 Not Modified Handling: Added logic to handle 304 responses from the API, allowing the SDK to reuse stale cache data and refresh its logical TTL without re-downloading the entire payload.

2. Enhanced Caching Wrapper

  • Updated saveToCache to wrap data in a payload containing both expires_at (logical TTL) and the actual data.
  • Extended the physical cache duration (TTL * 10) to ensure stale data is available for ETag validation even after it technically "expires".

@vazarkevych vazarkevych changed the title Feature/etag caching implementation feat: Implement ETag caching Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant