Add Redis caching, email refresh button, optimize page loading

- Add Redis service (docker-compose) for caching accounts, messages, payment status
- Cache accounts list (5min), messages (3min), payment status (10min)
- Auto-invalidate cache on import/delete/payment-check/note-update
- Add refresh button to email list panel (force re-fetch from IMAP)
- Messages API supports refresh=true param to bypass cache
- New cache.py module with RedisCache class

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-06 01:26:42 +08:00
parent 197c969e41
commit e96b2e1b4a
8 changed files with 210 additions and 20 deletions

View File

@@ -16,8 +16,12 @@ services:
environment:
# 管理员令牌,可以通过环境变量设置
- ADMIN_TOKEN=${ADMIN_TOKEN:-admin123}
- REDIS_URL=redis://redis:6379/0
# 可选:设置时区
- TZ=Asia/Shanghai
depends_on:
redis:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5001/"]
@@ -28,6 +32,24 @@ services:
networks:
- outlook-mail-network
redis:
image: redis:7-alpine
container_name: outlook-redis
command: redis-server --maxmemory 64mb --maxmemory-policy allkeys-lru
volumes:
- redis_data:/data
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 3
networks:
- outlook-mail-network
volumes:
redis_data:
networks:
outlook-mail-network:
driver: bridge
driver: bridge