Ruby Caching
Memory Cache
Section titled “Memory Cache”The Ruby SDK uses an in-memory cache with configurable TTL:
client = Flags::Client.builder .with_auth(auth) .with_memory_cache .buildThe memory cache:
- Provides fast read performance
- Is thread-safe for concurrent access
- Has data cleared on application restart
- Automatically refreshes based on the API-provided TTL
Cache Refresh
Section titled “Cache Refresh”The API response includes a TTL value that determines how frequently the SDK re-fetches flags. This happens automatically in the background — no manual configuration is needed.
Fallback Behavior
Section titled “Fallback Behavior”When the API is unavailable:
- The circuit breaker opens after 3 consecutive failures
- Flag checks return the last cached value
- If no cached value exists,
enabled?returnsfalse - After a 10-second cooldown, the SDK attempts to reconnect
This means your application continues to function even when the Flags.gg API is down.