Python Caching
SQLite Cache (Default)
Section titled “SQLite Cache (Default)”By default, flags are cached in a SQLite database at /tmp/flags.db.
# Default SQLite cacheclient = new_client( project_id="...", agent_id="...", environment_id="...",)
# Custom SQLite pathclient = new_client( project_id="...", agent_id="...", environment_id="...", sqlite_path="/var/data/flags.db",)Benefits:
- Persists across application restarts
- Thread-safe with proper locking
- Automatic cleanup of expired entries
Memory Cache
Section titled “Memory Cache”For short-lived processes or when persistence isn’t needed:
client = new_client( project_id="...", agent_id="...", environment_id="...", use_memory_cache=True,)Benefits:
- Faster read performance
- Lower overhead
- No file system dependencies
Cache Refresh
Section titled “Cache Refresh”Cache data is automatically refreshed based on the TTL provided by the Flags.gg API. No manual configuration is needed.