forked from baron/baron-sso
add PROFILE_CACHE_TTL
This commit is contained in:
@@ -35,6 +35,9 @@ CORS_ALLOWED_ORIGINS=http://localhost:5000 # 쿠키 인증 사용 시 정확한
|
||||
AUDIT_WORKER_COUNT=5 # 비동기 감사 로그 처리를 위한 고루틴 워커 수
|
||||
AUDIT_QUEUE_SIZE=2000 # 감사 로그 대기열(채널) 버퍼 크기
|
||||
|
||||
# Redis Cache Configuration
|
||||
PROFILE_CACHE_TTL=30m # User Profile Redis 캐시 만료 시간
|
||||
|
||||
# Descope Project ID (Required for Auth)
|
||||
DESCOPE_PROJECT_ID=P2t...your_descope_project_id
|
||||
DESCOPE_MANAGEMENT_KEY=your_descope_management_key_here
|
||||
|
||||
@@ -3807,8 +3807,14 @@ func (h *AuthHandler) resolveCurrentProfile(c *fiber.Ctx) (*domain.UserProfileRe
|
||||
// 4. Save to Redis Cache (Short TTL)
|
||||
if h.RedisService != nil && cacheKey != "" {
|
||||
if data, err := json.Marshal(profile); err == nil {
|
||||
// TTL: 1 minute to balance consistency and performance
|
||||
_ = h.RedisService.Set(cacheKey, string(data), 1*time.Minute)
|
||||
ttlStr := os.Getenv("PROFILE_CACHE_TTL")
|
||||
ttl := 30 * time.Minute // Default TTL
|
||||
if ttlStr != "" {
|
||||
if parsed, err := time.ParseDuration(ttlStr); err == nil {
|
||||
ttl = parsed
|
||||
}
|
||||
}
|
||||
_ = h.RedisService.Set(cacheKey, string(data), ttl)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user