-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
cache cloud id data in CloudIdManager #33764
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
Conversation
7d1132c to
dab9113
Compare
PVince81
left a comment
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.
👍 ok in general, nice to see that many tests
see 2 minor comments
| $this->contactsManager = $contactsManager; | ||
| $this->urlGenerator = $urlGenerator; | ||
| $this->userManager = $userManager; | ||
| $this->memCache = $cacheFactory->createDistributed('cloud_id_'); |
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.
not sure if distributed is really necessary, would local be enough and then we wouldn't need to also cache in a local array ? are we using this pattern of distributed+local array elsewhere also ?
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 distributed to make the cache invalidation that happen on displayname/adressbook change propagate.
The distributed+local caching is also used in the DisplayNameCache
|
|
||
| $key = $user . '@' . ($isLocal ? 'local' : $host); | ||
| $cached = $this->cache[$key] ?? $this->memCache->get($key); | ||
| if ($cached) { |
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.
if $cached is the string "0" this would not enter the if block, better always be safe with a strict check ?
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.
The cached value is an array, so "falsy" values are not a problem
Signed-off-by: Robin Appelman <[email protected]>
dab9113 to
dbcf174
Compare
CarlSchwan
left a comment
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.
Need to adjusts the test too ;)
Signed-off-by: Robin Appelman <[email protected]>
dbcf174 to
1626a56
Compare
Instead of either getting the local display name or searching for a calendar entry every time, cache things for 15m.
Cache is invalidated when a user changes his displayname or the calendar entry gets changed