Files
nepiedg 16844d4a42 Enhance AI and Redis integration for smoke logging features
- Added AI configuration options to .env.example and config.go for OpenAI integration.
- Implemented Redis caching for session management in main.go and auth middleware.
- Updated smoke logging service to support real smoking time (`smoke_at`) and AI advice retrieval.
- Enhanced API routes to include endpoints for AI advice and unlock functionality for non-members.
- Improved database schema with new tables for AI advice and unlock records.
- Expanded documentation to cover new AI features and Redis caching implementation.
2026-01-03 02:14:21 +00:00

23 lines
599 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Redis(可选)
当前项目引入 Redis 的主要目的:缓存 `session_key -> user`,减少每个受保护接口都查询 MySQL(尤其在并发增大时更明显)。
## 什么时候需要
- 访问量变大,MySQL 压力主要来自“鉴权查用户”这种高频读
- 需要做更复杂的能力:限流、计数、分布式锁、异步队列等
## 配置
`.env.example`
- `REDIS_ADDR`
- `REDIS_PASSWORD`
- `REDIS_DB`
- `REDIS_KEY_PREFIX`
- `REDIS_SESSION_TTL_SECONDS`
说明:
- 如果不配置 `REDIS_ADDR`,程序会自动禁用 Redis,行为与之前一致。