load(); } public function load() { $this->mChSpeedLimt = []; $all_ch_speeds = rkcachex('channel_speeds','refill-'); if($all_ch_speeds === false) { return false; } $all_ch_speeds = json_decode($all_ch_speeds,true); if(empty($all_ch_speeds)) { return false; } foreach ($all_ch_speeds as $name => $speed) { $this->mChSpeedLimt[$name] = intval($speed); } } public function update_cur($speeds) { $this->mChSpeedCur = $speeds; } public function is_over_chspeed($chname) { $limit = $this->mChSpeedLimt[$chname] ?? -1; if ($limit <= 0) { return false; } $cur = $this->mChSpeedCur[$chname] ?? 0; return $cur >= $limit; } }