Skip to content
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

Merged
merged 5 commits into from
May 10, 2018
Merged

Conversation

briankassouf
Copy link
Contributor

No description provided.

@@ -56,6 +70,7 @@ func NewCache(b Backend, size int, logger log.Logger) *Cache {
logger: logger,
// This fails safe.
enabled: new(uint32),
noCache: pm,
Copy link
Contributor

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 !.

@briankassouf briankassouf changed the title [WIP] physical/cache: Add a list of prefixes to not cache physical/cache: Add a list of prefixes to not cache May 9, 2018
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
Copy link
Contributor

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.

Copy link
Contributor Author

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

return false
}

// HasExactPath returns if the longest match is a path or is an exact for the
Copy link
Contributor

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..."


// HasExactPath returns if the longest match is a path or is an exact for the
// full path
func (p *PathManager) HasExactPath(path string) bool {
Copy link
Contributor

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)?

Copy link
Contributor

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.

Copy link
Contributor Author

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.

jefferai
jefferai previously approved these changes May 10, 2018
@jefferai jefferai added this to the 0.10.2 milestone May 10, 2018
@briankassouf briankassouf merged commit 790465f into master May 10, 2018
@briankassouf briankassouf deleted the no-cache branch May 10, 2018 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants