diff --git a/src/cache/CacheHandler.php b/src/cache/CacheHandler.php index b66fa64..2ba9db7 100644 --- a/src/cache/CacheHandler.php +++ b/src/cache/CacheHandler.php @@ -26,9 +26,9 @@ */ abstract class CacheHandler extends Module { - // cache time to only get cache or null if not present, arbitrary value + // cache time to only get cache or null if not present const MAX_CACHE_TIME = PHP_INT_MAX; - // cache time to only fetch if we don't have cached data, arbitrary value + // cache time to only fetch if we don't have cached data const MAX_CACHE_TIME_GET_NON_EXIST = CacheHandler::MAX_CACHE_TIME - 1; protected $cacheTimes = [ diff --git a/src/cache/impl/FlatFileCacheHandler.php b/src/cache/impl/FlatFileCacheHandler.php index 5b25225..8e7b1ce 100644 --- a/src/cache/impl/FlatFileCacheHandler.php +++ b/src/cache/impl/FlatFileCacheHandler.php @@ -29,7 +29,7 @@ */ class FlatFileCacheHandler extends CacheHandler { - protected $baseDirectory = "cache" . DIRECTORY_SEPARATOR . "HypixelPHP" . DIRECTORY_SEPARATOR; + protected $baseDirectory = __DIR__ . DIRECTORY_SEPARATOR . "cache" . DIRECTORY_SEPARATOR . "HypixelPHP" . DIRECTORY_SEPARATOR; /** * Get base file location for all cache files diff --git a/src/cache/impl/MongoCacheHandler.php b/src/cache/impl/MongoCacheHandler.php index 8ca2416..d206e67 100644 --- a/src/cache/impl/MongoCacheHandler.php +++ b/src/cache/impl/MongoCacheHandler.php @@ -55,7 +55,7 @@ public function ensureIndexes() { $db->selectCollection(CacheTypes::PLAYER_UUID)->createIndex(['name_lowercase' => 1], ['background' => true]); $db->selectCollection(CacheTypes::GUILDS)->createIndex(['record._id' => 1], ['background' => true]); - $db->selectCollection(CacheTypes::GUILDS)->createIndex(['extra.name_lower' => 1], ['background' => true]); + $db->selectCollection(CacheTypes::GUILDS)->createIndex(['record.name_lower' => 1], ['background' => true]); $db->selectCollection(CacheTypes::GUILDS_UUID)->createIndex(['uuid' => 1], ['background' => true]); $db->selectCollection(CacheTypes::GUILDS_NAME)->createIndex(['name_lower' => 1], ['background' => true]); @@ -275,7 +275,7 @@ function setGuildIDForName($name, $obj) { * @return mixed|null */ function getGuildIDForName($name) { - $query = ['extra.name_lower' => strtolower((string)$name)]; + $query = ['record.name_lower' => strtolower((string)$name)]; $data = $this->queryCollection(CacheTypes::GUILDS, $query); if ($data != null) { $cacheTime = $this->getCacheTime(CacheTimes::GUILD); diff --git a/src/responses/guild/Guild.php b/src/responses/guild/Guild.php index 366c9f3..0ed80f8 100644 --- a/src/responses/guild/Guild.php +++ b/src/responses/guild/Guild.php @@ -23,19 +23,6 @@ public function __construct(HypixelPHP $HypixelPHP, $guild) { $this->members = new GuildMemberList($this->getHypixelPHP(), $this); } - /** - * @param null $cached - * @throws \Plancke\HypixelPHP\exceptions\HypixelPHPException - */ - public function handleNew($cached = null) { - parent::handleNew($cached); - - $extraSetter = []; - $extraSetter['name_lower'] = strtolower($this->getName()); - - $this->setExtra($extraSetter, false); - } - /** * @return string */