diff --git a/app/Utils/MsgAlert.php b/app/Utils/MsgAlert.php index 8963ba29..a1dd84ae 100644 --- a/app/Utils/MsgAlert.php +++ b/app/Utils/MsgAlert.php @@ -73,7 +73,7 @@ final class MsgAlert { public function remove($name): void { foreach (self::$alerts as $item) { - if ($item['name'] = $name) { + if ($item['name'] == $name) { unset(self::$alerts[$name]); NexusDB::redis()->lRem($this->getListKey(), json_encode($item)); } diff --git a/public/torrentrss.php b/public/torrentrss.php index ade339cb..dd276b34 100644 --- a/public/torrentrss.php +++ b/public/torrentrss.php @@ -178,11 +178,16 @@ $sort = "id desc"; $fieldStr = "torrents.id, torrents.category, torrents.name, torrents.small_descr, torrent_extras.descr, torrents.info_hash, torrents.size, torrents.added, torrents.anonymous, torrents.owner, categories.name AS category_name"; if (!$noNormalResults) { $query = "SELECT $fieldStr FROM torrents LEFT JOIN categories ON torrents.category = categories.id left join torrent_extras on torrent_extras.torrent_id = torrents.id $normalWhere ORDER BY $sort LIMIT $limit"; - $normalRows = \Nexus\Database\NexusDB::select($query); + $normalRows = \Nexus\Database\NexusDB::remember(sprintf("nexus_rss:normal:%s", md5($query)), 300, function () use ($query) { + return \Nexus\Database\NexusDB::select($query); + }); } if (!empty($prependIdArr) && $startindex == 0) { $prependIdStr = implode(',', $prependIdArr); - $prependRows = \Nexus\Database\NexusDB::select("SELECT $fieldStr FROM torrents LEFT JOIN categories ON torrents.category = categories.id left join torrent_extras on torrent_extras.torrent_id = torrents.id where torrents.id in ($prependIdStr) and $where ORDER BY field(torrents.id, $prependIdStr)"); + $query = "SELECT $fieldStr FROM torrents LEFT JOIN categories ON torrents.category = categories.id left join torrent_extras on torrent_extras.torrent_id = torrents.id where torrents.id in ($prependIdStr) and $where ORDER BY field(torrents.id, $prependIdStr)"; + $prependRows = \Nexus\Database\NexusDB::remember(sprintf("nexus_rss:prepend:%s", md5($query)), 300, function () use ($query) { + return \Nexus\Database\NexusDB::select($query); + }); } $list = []; foreach ($prependRows as $row) {