PHP code example of limingxinleo / idempotent
1. Go to this page and download the library: Download limingxinleo/idempotent library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
limingxinleo / idempotent example snippets
use Hyperf\Utils\ApplicationContext;
use Idempotent\Idempotent;
$container = ApplicationContext::getContainer();
$id = 'create_order:1';
$result = $container->get(Idempotent::class)->run($id, static function(){
sleep(2);
return uniqid();
});
var_dump($result);