redis = $redis_prov->getRedisClient(); $this->loc_key = $loc_key; $this->status_key = $status_key; } public function addActiveRider($id, $lat, $lng) { $this->redis->geoadd( $this->loc_key, $lng, $lat, $id ); } public function getAllActiveRiders() { $all_riders = $this->redis->georadius( $this->loc_key, 0, 0, 41000, 'km', ['WITHCOORD' => true] ); $locs = []; foreach ($all_riders as $data) { $id = $data[0]; $lng = $data[1][0]; $lat = $data[1][1]; $locs[$id] = [ 'longitude' => $lng, 'latitude' => $lat, ]; } // error_log(print_r($all_riders, true)); return $locs; } public function removeActiveRider($id) { $this->redis->zrem( $this->loc_key, $id ); } public function incJobOrderCount($id, $status) { $this->redis->hincrby($this->status_key, $id, 1); } public function decJobOrderCount($id, $status) { $this->redis->hincrby($this->status_key, $id, -1); } }