| 1234567891011121314151617181920212223242526272829303132333435363738 |
- # ==================== cache_config.py ====================
- """
- Centralized cache configuration for the application.
- Set ENABLE_CACHING to True to enable all caches, False to disable.
- """
- # ⚡ MASTER CACHE CONTROL - Change this single variable to enable/disable ALL caching
- ENABLE_CACHING = False # Default: OFF
- # Individual cache controls (controlled by ENABLE_CACHING)
- ENABLE_ATTRIBUTE_EXTRACTION_CACHE = ENABLE_CACHING
- ENABLE_EMBEDDING_CACHE = ENABLE_CACHING
- ENABLE_CLIP_MODEL_CACHE = ENABLE_CACHING
- # Cache size limits (only used when caching is enabled)
- ATTRIBUTE_CACHE_MAX_SIZE = 1000
- EMBEDDING_CACHE_MAX_SIZE = 500
- def is_caching_enabled() -> bool:
- """
- Check if caching is enabled globally.
- Returns: bool indicating if caching is enabled
- """
- return ENABLE_CACHING
- def get_cache_config() -> dict:
- """
- Get current cache configuration.
- Returns: dict with cache settings
- """
- return {
- "master_cache_enabled": ENABLE_CACHING,
- "attribute_extraction_cache": ENABLE_ATTRIBUTE_EXTRACTION_CACHE,
- "embedding_cache": ENABLE_EMBEDDING_CACHE,
- "clip_model_cache": ENABLE_CLIP_MODEL_CACHE,
- "attribute_cache_max_size": ATTRIBUTE_CACHE_MAX_SIZE,
- "embedding_cache_max_size": EMBEDDING_CACHE_MAX_SIZE
- }
|