Skip to content

Commit e5d6fed

Browse files
committed
Remove Memcached from NewsCategory
1 parent dea47a7 commit e5d6fed

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

src/libraries/NewsCategory.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,6 @@ public function __construct($data) {
4242
}
4343

4444
public static function getAll() {
45-
$cache_key = "bnetdocs-newscategories";
46-
$cache_val = Common::$cache->get($cache_key);
47-
if ($cache_val !== false && !empty($cache_val)) {
48-
$ids = explode(",", $cache_val);
49-
$objects = [];
50-
foreach ($ids as $id) {
51-
$objects[] = new self($id);
52-
}
53-
return $objects;
54-
}
5545
if (!isset(Common::$database)) {
5646
Common::$database = DatabaseDriver::getDatabaseObject();
5747
}
@@ -68,17 +58,11 @@ public static function getAll() {
6858
if (!$stmt->execute()) {
6959
throw new QueryException("Cannot refresh news categories");
7060
}
71-
$ids = [];
7261
$objects = [];
7362
while ($row = $stmt->fetch(PDO::FETCH_OBJ)) {
74-
$ids[] = (int) $row->id;
7563
$objects[] = new self($row);
76-
Common::$cache->set(
77-
"bnetdocs-newscategory-" . $row->id, serialize($row), 300
78-
);
7964
}
8065
$stmt->closeCursor();
81-
Common::$cache->set($cache_key, implode(",", $ids), 300);
8266
return $objects;
8367
} catch (PDOException $e) {
8468
throw new QueryException("Cannot refresh news categories", $e);
@@ -112,15 +96,6 @@ protected static function normalize(StdClass &$data) {
11296
}
11397

11498
public function refresh() {
115-
$cache_key = "bnetdocs-newscategory-" . $this->id;
116-
$cache_val = Common::$cache->get($cache_key);
117-
if ($cache_val !== false) {
118-
$cache_val = unserialize($cache_val);
119-
$this->filename = $cache_val->filename;
120-
$this->label = $cache_val->label;
121-
$this->sort_id = $cache_val->sort_id;
122-
return true;
123-
}
12499
if (!isset(Common::$database)) {
125100
Common::$database = DatabaseDriver::getDatabaseObject();
126101
}
@@ -147,7 +122,6 @@ public function refresh() {
147122
$this->filename = $row->filename;
148123
$this->label = $row->label;
149124
$this->sort_id = $row->sort_id;
150-
Common::$cache->set($cache_key, serialize($row), 300);
151125
return true;
152126
} catch (PDOException $e) {
153127
throw new QueryException("Cannot refresh news category", $e);

0 commit comments

Comments
 (0)