-
Notifications
You must be signed in to change notification settings - Fork 2k
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
deps: upgrade to hashicorp/golang-lru/v2 #16085
Conversation
9e97c01
to
2436afa
Compare
2436afa
to
633cef7
Compare
633cef7
to
b85d9b3
Compare
b85d9b3
to
d771f9d
Compare
d771f9d
to
13dbfb7
Compare
13dbfb7
to
758862e
Compare
d7a844e
to
e86a86e
Compare
e86a86e
to
fd00d4e
Compare
fd00d4e
to
a3ae76d
Compare
a3ae76d
to
b10620d
Compare
b10620d
to
6d2ac54
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I love the added type-safety this gives us everywhere it's used.
ValidACLAuthMethod = regexp.MustCompile("^[a-zA-Z0-9-]{1,128}$") | ||
) | ||
|
||
type ACLCacheEntry[T any] lang.Pair[T, time.Time] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for my education, what does lang.Pair
get us over something like this?
type ACLCacheEntry[T any] struct {
val T
t time.Time
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just a way to signal the (combined) type is irrelevant - it's an implementation detail of the cache, so there isn't much need to declare a whole type around it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, cool. There's probably a bunch of other places this would be handy too.
Upgrade to hashicorp/golang-lru/v2, and refactor the ACL cache to leverage all the generics. Previously each cache entry contained 3 pointers, only one of which would be in use - so we should get some space savings out of that (not that the cache sizes are large).