fix telegram
This commit is contained in:
66
deploy-package-20260223-151231/backend/modules/reports/cache/__init__.py
vendored
Normal file
66
deploy-package-20260223-151231/backend/modules/reports/cache/__init__.py
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
"""
|
||||
Cache module for ROA2WEB
|
||||
|
||||
Provides hybrid two-tier caching (Memory L1 + SQLite L2)
|
||||
with performance tracking and event-based invalidation.
|
||||
|
||||
Usage:
|
||||
# Initialize cache at app startup
|
||||
from app.cache import init_cache
|
||||
from app.cache.config import CacheConfig
|
||||
|
||||
config = CacheConfig.from_env()
|
||||
await init_cache(config)
|
||||
|
||||
# Use @cached decorator in services
|
||||
from app.cache.decorators import cached
|
||||
|
||||
@cached(cache_type='dashboard_summary', key_params=['company', 'username'])
|
||||
async def get_complete_summary(company: str, username: str):
|
||||
# ... Oracle query logic ...
|
||||
|
||||
# Get cache manager for manual operations
|
||||
from app.cache import get_cache
|
||||
|
||||
cache = get_cache()
|
||||
await cache.invalidate(company_id=123)
|
||||
"""
|
||||
|
||||
from .config import CacheConfig
|
||||
from .cache_manager import (
|
||||
init_cache,
|
||||
get_cache,
|
||||
close_cache,
|
||||
CacheManager
|
||||
)
|
||||
from .decorators import cached
|
||||
from .event_monitor import (
|
||||
init_event_monitor,
|
||||
get_event_monitor,
|
||||
toggle_event_monitor,
|
||||
preload_all_schema_mappings
|
||||
)
|
||||
from .benchmarks import run_baseline_benchmarks
|
||||
|
||||
__all__ = [
|
||||
# Configuration
|
||||
'CacheConfig',
|
||||
|
||||
# Cache Manager
|
||||
'init_cache',
|
||||
'get_cache',
|
||||
'close_cache',
|
||||
'CacheManager',
|
||||
|
||||
# Decorators
|
||||
'cached',
|
||||
|
||||
# Event Monitor
|
||||
'init_event_monitor',
|
||||
'get_event_monitor',
|
||||
'toggle_event_monitor',
|
||||
'preload_all_schema_mappings',
|
||||
|
||||
# Benchmarks
|
||||
'run_baseline_benchmarks',
|
||||
]
|
||||
Reference in New Issue
Block a user