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

Remove core restriction in cache and turn it into an active/standby restriction instead #3849

Merged
merged 7 commits into from
Jan 26, 2018

Conversation

jefferai
Copy link
Member

No description provided.

@jefferai jefferai added this to the 0.9.2 milestone Jan 25, 2018
vault/core.go Outdated
purgable.Purge(c.activeContext)
}
c.physicalCache.Purge(c.activeContext)
c.physicalCache.SetEnabled(true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to conditionally enable it based on if we have caching disabled in the config

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops yes you're right. I thought about that before and then forgot to do it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

// Purgable is an optional interface for backends that support
// purging of their caches.
type Purgable interface {
// An interface for backends that can toggle on or off special functionality
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit, but it should start with "ToggleablePurgemonster is ..."

vishalnayak
vishalnayak previously approved these changes Jan 25, 2018
@@ -63,268 +64,3 @@ func TestCache_Purge(t *testing.T) {
t.Fatalf("should not have key")
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add test cases for when cache.SetEnabled(false) to make sure operations are not getting/modifying from cached values?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add such a test, good idea.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

backend: b,
lru: cache,
locks: locksutil.CreateLocks(),
logger: logger,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enabled seems to be false by default (meaning no cache), is this intentional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. Fail safe.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, in that case perhaps adding a comment on the need to call SetEnabled before the Cache really starts caching would be helpful.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

calvn
calvn previously approved these changes Jan 25, 2018
Copy link
Contributor

@calvn calvn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

briankassouf
briankassouf previously approved these changes Jan 26, 2018
Copy link
Contributor

@briankassouf briankassouf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

chrishoffman
chrishoffman previously approved these changes Jan 26, 2018
Copy link
Contributor

@chrishoffman chrishoffman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

// Purgable is an optional interface for backends that support
// purging of their caches.
type Purgable interface {
// ToggleablePurgemonsteris an interface for backends that can toggle on or off
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/ToggleablePurgemonsteris/ToggleablePurgemonster is/

calvn
calvn previously approved these changes Jan 26, 2018
@jefferai jefferai dismissed stale reviews from calvn, chrishoffman, and briankassouf via ae095fd January 26, 2018 03:21
@jefferai jefferai merged commit a612abc into master Jan 26, 2018
@jefferai jefferai deleted the core-cache-monsta branch January 26, 2018 03:21
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.

5 participants