-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
physical/cache: Add a list of prefixes to not cache #4515
Conversation
physical/cache.go
Outdated
@@ -56,6 +70,7 @@ func NewCache(b Backend, size int, logger log.Logger) *Cache { | |||
logger: logger, | |||
// This fails safe. | |||
enabled: new(uint32), | |||
noCache: pm, |
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.
Should this be named something like cacheExceptions since the path manager could technically toggle the behavior? For example, don't cache path1/
but still cache path1/key1
by prepending !
.
vault/core.go
Outdated
@@ -1732,6 +1727,12 @@ func (c *Core) postUnseal() (retErr error) { | |||
c.metricsCh = make(chan struct{}) | |||
go c.emitMetrics(c.metricsCh) | |||
|
|||
// Enable the cache |
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.
Any reason not to enable the cache earlier? I think we would want to cache some of these entries.
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 that most of these things are unlikely to be read out of cache during normal operation. I don't think it matters much though, i'll move it back up for now
helper/pathmanager/pathmanager.go
Outdated
return false | ||
} | ||
|
||
// HasExactPath returns if the longest match is a path or is an exact for the |
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.
wording: "...or is an exact for the..."
helper/pathmanager/pathmanager.go
Outdated
|
||
// HasExactPath returns if the longest match is a path or is an exact for the | ||
// full path | ||
func (p *PathManager) HasExactPath(path string) bool { |
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.
Given the similarity to HasPath, would HasPath be better as HasPath(path string, exact bool)
?
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.
HasPath is used much more than HasExactPath (probably 95%/5% or more). I don't really see too much risk in have two methods that have similar behavior instead of one that handles all cases.
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.
I actually prefer the verboseness of having different function names.
No description provided.