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

CachingUserDetailsService should only putUserInCache if user == null #233

Closed
wants to merge 1 commit into from

Conversation

vorburger
Copy link

Unless I'm completely misunderstanding something here, this seems wrong.

Unless I'm completely misunderstanding something here, this seems wrong.
@jgrandja
Copy link
Contributor

Thanks for the PR!

Given the current logic, if the UserCache returns an existing UserDetails then it will be put back into the UserCache before the method returns. Although this may seem unnecessary there wouldn't be any side effects from this action as the same UserDetails instance is put into the cache using the same key.

I'm going to close this PR but please feel free to re-open it if you have further discussions around this.
Thank you.

@jgrandja jgrandja closed this Apr 21, 2016
@jon-chard
Copy link

jon-chard commented Nov 15, 2019

I have a use case where there is a side effect; when the UserCache implementation you're using has an evict after write rather than an evict after read.

As the code stands, the UserDetails is always written to the cache, which resets the write time, so the user details is never evicted if it's under heavy load.

@jgrandja I think this should be reopened

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.

3 participants