feat(light): 添加Redis缓存支持和SSE实时数据推送功能

- 在requirements.txt中添加redis依赖并更新requests版本
- 在.env.example中添加Redis相关配置
- 重构light服务层,使用Redis替代内存缓存,增加线程安全机制
- 新增SSE接口,每15秒推送一次用户灯牌数据更新
- 优化日志配置和错误处理机制
This commit is contained in:
2025-12-16 15:37:40 +08:00
parent 3b37e13833
commit 953da74b29
4 changed files with 259 additions and 89 deletions

View File

@@ -8,4 +8,13 @@ API_PORT=8000
# Security
SECRET_KEY=your-secret-key-here
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
ACCESS_TOKEN_EXPIRE_MINUTES=30
# Redis configuration
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_DB=0
REDIS_PASSWORD=
# Redis cache configuration
REDIS_CACHE_DURATION_MINUTES=10