growthbook-python
growthbook-python copied to clipboard
feat: Implement AbstractAsyncFeatureCache for async SDK clients
This PR introduces asynchronous feature caching support, which is critical for the asynchronous operation mode of the SDK (GrowthBookClient). Utilizing an async cache (e.g., Redis) significantly reduces latency and API load by eliminating the need for HTTP requests during a Cache HIT.
Changes
- Added
AbstractAsyncFeatureCache: Defined the interface for asynchronous caching, including methods likeget(key),set(key, value, ttl). - Updated
FeatureRepository: Theload_features_asyncmethod now utilizesself.async_cache(if provided inOptions) to check and store features in the cache.