RBAC: Optimize permissions caching (#92673)

* Access control: Use composite cache key for team permissions

* use composite key for teams

* use cache for hotpath (getCachedUserPermissions)

* don't cache empty teams set

* don't pass permissions as argument

* early return if no teams found

* reload cache correctly

* optimize allocations

* Clear user's teams cache

* remove composite cache for teams

* fix linter

* don't clear teams permissions

* pre-allocate memory for basic roles permissions
This commit is contained in:
Alexander Zobnin
2024-09-03 15:46:56 +02:00
committed by GitHub
parent 6244c2be2c
commit 88259da745
3 changed files with 33 additions and 16 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"github.com/grafana/grafana/pkg/apimachinery/identity"
)
func GetPermissionCacheKey(user identity.Requester) string {
func GetUserPermissionCacheKey(user identity.Requester) string {
return fmt.Sprintf("rbac-permissions-%s", user.GetCacheKey())
}