forked from zanfranceschi/rinha-de-backend-2023-q3
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from eudiegoborgs/dev
Adiciona endpoints
- Loading branch information
Showing
11 changed files
with
439 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Consumer; | ||
|
||
use Hyperf\AsyncQueue\Process\ConsumerProcess; | ||
use Hyperf\Process\Annotation\Process; | ||
|
||
#[Process(name: "async-queue")] | ||
class PersonConsumer extends ConsumerProcess | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Job; | ||
|
||
use Hyperf\AsyncQueue\Job; | ||
use Hyperf\DbConnection\Db; | ||
|
||
class PersonJob extends Job | ||
{ | ||
public $params; | ||
|
||
public function __construct($params) | ||
{ | ||
// It's best to use normal data here. Don't pass the objects that carry IO, such as PDO objects. | ||
$this->params = $params; | ||
} | ||
|
||
public function handle() | ||
{ | ||
Db::table('person')->insert($this->params); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Era exatamente isso, primeiro cache e depois a aplicação se vira para salvar no DB.