Skip to content

Commit 679cc98

Browse files
committed
Remove cache from ServerType class
1 parent 97d4a5f commit 679cc98

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

src/libraries/ServerType.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,6 @@ public function __construct($data) {
3535
}
3636

3737
public static function getAllServerTypes() {
38-
$cache_key = "bnetdocs-servertypes";
39-
$cache_val = Common::$cache->get($cache_key);
40-
if ($cache_val !== false && !empty($cache_val)) {
41-
$ids = explode(",", $cache_val);
42-
$objects = [];
43-
foreach ($ids as $id) {
44-
$objects[] = new self($id);
45-
}
46-
return $objects;
47-
}
4838
if (!isset(Common::$database)) {
4939
Common::$database = DatabaseDriver::getDatabaseObject();
5040
}
@@ -59,17 +49,11 @@ public static function getAllServerTypes() {
5949
if (!$stmt->execute()) {
6050
throw new QueryException("Cannot refresh server types");
6151
}
62-
$ids = [];
6352
$objects = [];
6453
while ($row = $stmt->fetch(PDO::FETCH_OBJ)) {
65-
$ids[] = (int) $row->id;
6654
$objects[] = new self($row);
67-
Common::$cache->set(
68-
"bnetdocs-servertype-" . $row->id, serialize($row), 300
69-
);
7055
}
7156
$stmt->closeCursor();
72-
Common::$cache->set($cache_key, implode(",", $ids), 300);
7357
return $objects;
7458
} catch (PDOException $e) {
7559
throw new QueryException("Cannot refresh server types", $e);
@@ -100,13 +84,6 @@ protected static function normalize(StdClass &$data) {
10084
}
10185

10286
public function refresh() {
103-
$cache_key = "bnetdocs-servertype-" . $this->id;
104-
$cache_val = Common::$cache->get($cache_key);
105-
if ($cache_val !== false) {
106-
$cache_val = unserialize($cache_val);
107-
$this->label = $cache_val->label;
108-
return true;
109-
}
11087
if (!isset(Common::$database)) {
11188
Common::$database = DatabaseDriver::getDatabaseObject();
11289
}
@@ -129,7 +106,6 @@ public function refresh() {
129106
$stmt->closeCursor();
130107
self::normalize($row);
131108
$this->label = $row->label;
132-
Common::$cache->set($cache_key, serialize($row), 300);
133109
return true;
134110
} catch (PDOException $e) {
135111
throw new QueryException("Cannot refresh server type", $e);

0 commit comments

Comments
 (0)