Go Caching
SQLite Cache (Default)
Section titled “SQLite Cache (Default)”By default, the Go SDK caches flags in a SQLite database at /tmp/flags.db. This persists across application restarts.
// Default SQLite cacheclient := flags.NewClient( flags.WithAuth(auth),)
// Custom SQLite pathpath := "/var/data/flags.db"client := flags.NewClient( flags.WithAuth(auth), flags.SetFileName(&path),)Memory Cache
Section titled “Memory Cache”For applications where persistence isn’t needed:
client := flags.NewClient( flags.WithAuth(auth), flags.WithMemory(),)The memory cache uses sync.Map for thread-safe concurrent access.
Cache Refresh
Section titled “Cache Refresh”The API response includes a refresh interval. The SDK automatically re-fetches flags at this interval. No manual configuration is needed.
Cache Interface
Section titled “Cache Interface”The Go SDK defines a Cache interface with two implementations:
cache.SQLiteCache— Persistent storage using SQLitecache.MemoryCache— In-memory storage usingsync.Map
You can implement the Cache interface to create a custom cache backend.