Configuration¶
The configuration module provides global settings and cache configuration for the BingX API Client.
- class bingx_py.config.CacheConfig[source]¶
Bases:
objectConfiguration class for managing cache settings and instances.
This avoids the use of global variables.
- create_cache(cache_type, host='localhost', port=6379, db=0)[source]¶
Create a cache instance based on the type.
- Parameters:
cache_type (CacheType) – The type of cache to create.
host (str) – Redis host. Defaults to “localhost”.
port (int) – Redis port. Defaults to 6379.
db (int) – Redis database number. Defaults to 0.
- Returns:
The created cache instance.
- Return type:
AsyncMemoryCache | SyncMemoryCache | AsyncRedisCache | SyncRedisCache
- get_cache()[source]¶
Get the cache instance.
- Returns:
AsyncMemoryCache | SyncMemoryCache | AsyncRedisCache | SyncRedisCache | None
- Return type:
The current cache instance.
- is_unsafe_cache_enabled()[source]¶
Check if unsafe cache mode is enabled.
- Returns:
bool
- Return type:
True if unsafe cache mode is enabled, otherwise False.
- set_cache(cache_type, host='localhost', port=6379, db=0)[source]¶
Set the cache instance based on the configured cache type.
- Parameters:
cache_type (CacheType) – The type of cache to set.
host (str) – Redis host. Defaults to “localhost”.
port (int) – Redis port. Defaults to 6379.
db (int) – Redis database number. Defaults to 0.
- Return type:
None