fixed sonarqube issues

This commit is contained in:
2025-12-17 09:42:18 +08:00
parent d385044237
commit e6b3e3b3ae
9 changed files with 137 additions and 123 deletions
+5 -5
View File
@@ -18,7 +18,7 @@ Your authorization microservice is now **fully horizontally scalable** using Red
#### 2. Cache Architecture
```
```text
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Instance 1 │ │ Instance 2 │ │ Instance 3 │
└──────┬──────┘ └──────┬──────┘ └──────┬──────┘
@@ -39,20 +39,20 @@ Your authorization microservice is now **fully horizontally scalable** using Red
#### 3. Key Features
**Dual-Layer Caching**
#### Dual-Layer Caching
- Primary: Redis (distributed, shared across instances)
- Secondary: Local in-memory (failover, performance boost)
- Automatic fallback when Redis unavailable
**Consistency Guarantees**
#### Consistency Guarantees
- All instances share the same Redis cache
- 30-second automatic cache refresh
- Manual invalidation via `InvalidateUserCache()`
- Force refresh via `RefreshCacheNow()`
**Performance Optimizations**
#### Performance Optimizations
- JSON serialization for complex objects
- 100ms timeout for Redis operations
@@ -313,7 +313,7 @@ var (
| Medium Cluster | 5 | ~10,000 | <20ms |
| Large Cluster | 10+ | ~20,000+ | <25ms |
_Note: Assumes Redis on same network, PostgreSQL optimized_
> **Note:** Assumes Redis on same network, PostgreSQL optimized
### Cache Effectiveness