hypixel-php icon indicating copy to clipboard operation
hypixel-php copied to clipboard

Fix guild cache when requesting guild through UUID or name and add support for PHP 8

Open MaxKorlaar opened this issue 2 years ago • 3 comments

The method CacheUtil::isExpired compares timestamps in order to validate if a timestamp is older than allowed, defined by a given cache time. Both the timestamp and cache time should be in milliseconds, but are given in seconds, therefore always yielding true as a result, breaking the caching mechanism. Additionally, support for PHP 8 is added in composer.json.

MaxKorlaar avatar Oct 14 '21 19:10 MaxKorlaar

By the way @Plancke, don't forget to add the label 'hacktoberfest' to this repository for some Hacktoberfest goodness 😉

MaxKorlaar avatar Oct 14 '21 19:10 MaxKorlaar

There are a couple more calls to that method in the Mongo handler as well, afaik all timestamps in cached data are seconds so those are probably also non-functioning. Though with how I check the existing guild's collection first before doing this byName/byPlayer lookup it's probably not impacted.

Plancke avatar Oct 15 '21 18:10 Plancke

Fair enough, I don't use that handler myself so I've missed that. I'll look into it later!

MaxKorlaar avatar Oct 17 '21 18:10 MaxKorlaar