-
Notifications
You must be signed in to change notification settings - Fork 3
AuthZService: improve authz caching #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: cache-optimization-baseline
Are you sure you want to change the base?
AuthZService: improve authz caching #2
Conversation
* remove the use of client side cache for in-proc authz client Co-authored-by: Gabriel MABILLE <[email protected]> * add a permission denial cache, fetch perms if not in either of the caches Co-authored-by: Gabriel MABILLE <[email protected]> * Clean up tests Co-authored-by: Ieva <[email protected]> * Cache tests Co-authored-by: Ieva <[email protected]> * Add test to list + cache Co-authored-by: Ieva <[email protected]> * Add outdated cache test Co-authored-by: Ieva <[email protected]> * Re-organize metrics Co-authored-by: Ieva <[email protected]> --------- Co-authored-by: Gabriel MABILLE <[email protected]>
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||
User description
PR #2
PR Type
Enhancement
Description
Add permission denial cache to avoid repeated database queries for denied permissions
Implement two-tier caching strategy: check denial cache first, then permission cache
Remove client-side caching from in-process RBAC client, use NoopCache instead
Refactor permission retrieval to use new getCachedIdentityPermissions method
Add comprehensive tests for cache hit/miss scenarios and denial cache behavior
Diagram Walkthrough
File Walkthrough
rbac.go
Refactor RBAC client initialization and caching strategypkg/services/authz/rbac.go
caching
cache.go
Add permission denial cache key generationpkg/services/authz/rbac/cache.go
permissions
granular denial tracking
service.go
Implement two-tier caching with denial cachepkg/services/authz/rbac/service.go
permissions
queries
cache
lookup
getAnonymousPermissions
denied access
service_test.go
Add comprehensive cache behavior testspkg/services/authz/rbac/service_test.go
getCachedIdentityPermissions)
misses, outdated cache, and denial cache
permissions