mirror of
https://github.com/lukaszraczylo/graphql-monitoring-proxy.git
synced 2026-10-12 05:32:36 +00:00
Improve caching by adding user ids and roles to hash.
This commit is contained in:
@@ -327,8 +327,11 @@ func extractUserInfo(c *fiber.Ctx) (string, string) {
|
||||
|
||||
// handleCaching manages the caching logic for GraphQL requests
|
||||
func handleCaching(c *fiber.Ctx, parsedResult *parseGraphQLQueryResult, userID string) (bool, error) {
|
||||
// Calculate query hash for cache key
|
||||
calculatedQueryHash := libpack_cache.CalculateHash(c)
|
||||
// Extract user role for cache key (in addition to userID already passed)
|
||||
_, userRole := extractUserInfo(c)
|
||||
|
||||
// Calculate query hash for cache key - now includes user context for security
|
||||
calculatedQueryHash := libpack_cache.CalculateHash(c, userID, userRole)
|
||||
|
||||
// Set cache time from header or default
|
||||
if parsedResult.cacheTime == 0 {
|
||||
|
||||
Reference in New Issue
Block a user