-
-
Notifications
You must be signed in to change notification settings - Fork 342
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
Introduce GameProfileCache, and extract existing cache method to it #1068
Conversation
Whats a usecase of being able to replace the cache? |
@ryantheleach Looking up from your own profile cache instead of hitting Mojang's API, which is rate limited. |
@kashike I believe the built-in implementation uses a local cache to avoid making multiple requests for the same profile in a short amount of time, so that shouldn't be needed. |
I'm well aware of the internal cache. Keep in mind networks that have many servers can utilise a central cache (database, etc), instead of requesting from Mojang. |
* the cache did not contain a profile with the provided id | ||
*/ | ||
default Optional<GameProfile> get(UUID uniqueId) { | ||
checkNotNull(uniqueId, "unique 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.
uniqueId
, name this the same as the parameter
This is just my opinion and should probably not be done until others agree, but it may make more sense to have this as an overridable service. That way by default it can use the vanilla behaviour, but another plugin can provide an implementation that uses their own database etc.. Seeing as we already have a system like that in place, it only makes sense to use it. @gabizou Thoughts? |
@me4502 The reason this isn't a service is because it would be very different from others - this provides (assuming vanilla-based in this context) Mojang's implementation, by default, with A possible "solution" would be to keep |
API | Common
This introduces a replaceable
GameProfileCache
that is used (internally) for resolving profiles and profile related data.