Improve caching by adding user ids and roles to hash.

This commit is contained in:
2025-11-22 17:02:16 +00:00
parent 28223b40da
commit 39dc7b49cf
11 changed files with 198 additions and 43 deletions
+5 -2
View File
@@ -332,8 +332,11 @@ func performProxyRequest(c *fiber.Ctx, proxyURL string) error {
return performProxyRequestWithRetries(c, proxyURL)
}
// Calculate cache key for potential fallback
cacheKey := libpack_cache.CalculateHash(c)
// Extract user context for cache key (needed for circuit breaker fallback)
userID, userRole := extractUserInfo(c)
// Calculate cache key for potential fallback - includes user context for security
cacheKey := libpack_cache.CalculateHash(c, userID, userRole)
// Execute request through circuit breaker
_, err := cb.Execute(func() (interface{}, error) {