Refactor cache L2 storage to use SQLAlchemy DB
Replaces the L2 cache layer's SQLite implementation with an async SQLAlchemy-based database model (CacheEntries). Updates cache_manager.py to use db_query and db_save for cache operations, adds semantic cache handling with ChromaDB, and introduces async cache clearing and expiration cleaning methods. Adds the CacheEntries model and integrates it into the database API.
This commit is contained in:
@@ -15,7 +15,8 @@ from src.common.logger import get_logger
|
||||
from src.common.database.sqlalchemy_models import (
|
||||
Base, get_db_session, Messages, ActionRecords, PersonInfo, ChatStreams,
|
||||
LLMUsage, Emoji, Images, ImageDescriptions, OnlineTime, Memory,
|
||||
Expression, ThinkingLog, GraphNodes, GraphEdges, Schedule, MaiZoneScheduleStatus
|
||||
Expression, ThinkingLog, GraphNodes, GraphEdges, Schedule, MaiZoneScheduleStatus,
|
||||
CacheEntries
|
||||
)
|
||||
|
||||
logger = get_logger("sqlalchemy_database_api")
|
||||
@@ -38,6 +39,7 @@ MODEL_MAPPING = {
|
||||
'GraphEdges': GraphEdges,
|
||||
'Schedule': Schedule,
|
||||
'MaiZoneScheduleStatus': MaiZoneScheduleStatus,
|
||||
'CacheEntries': CacheEntries,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user