Making multiple identical function calls has the same effect as making a single function call.

Overview

幂等器

安装

composer require limingxinleo/idempotent

使用

Hyperf 框架

以下代码会在 2s 内返回相同的数据



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);
You might also like...
this is a simple website about news and it has some features

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

This project has reached its end-of-life (EOL).

EOL Notice This project has reached its end-of-life (EOL). README Requirements The supported Magento version is 1.9.x Features ajax navigation using h

Magento extension which makes it impossible for a customer to log in until the account has been activated by the administrator.

This Magento 1 extension is orphaned, unsupported and no longer maintained. If you use it, you are effectively adopting the code for your own project.

Admidio is a free open source user management system for websites of organizations and groups. The system has a flexible role model so that it’s possible to reflect the structure and permissions of your organization.
Admidio is a free open source user management system for websites of organizations and groups. The system has a flexible role model so that it’s possible to reflect the structure and permissions of your organization.

Admidio Admidio is a free open source user management system for websites of organizations and groups. The system has a flexible role model so that it

Plugin Notify OP Or Staff Has Permission antixraype.check when someone breaks ore

General Plugin Notify OP Or Staff Has Permission antixraype.check when someone breaks ore If the message repeats many times, check if the player is us

Icinga Director has been designed to make Icinga 2 configuration handling easy
Icinga Director has been designed to make Icinga 2 configuration handling easy

The Director aims to be your new favourite Icinga config deployment tool. Director is designed for those who want to automate their configuration deployment and those who want to grant their “point & click” users easy access to the configuration.

Optimizes class loading performance by generating a single PHP file containing all of the autoloaded files.
Optimizes class loading performance by generating a single PHP file containing all of the autoloaded files.

Class Preloader for PHP This tool is used to generate a single PHP script containing all of the classes required for a specific use case. Using a sing

Simple user settings facade for Hyperf. Settings are stored as JSON in a single database column, so you can easily add it to an existing table.

hyperf-user-settings Simple user settings util for hyperf Settings are stored as JSON in a single database column, so you can easily add it to an exis

High-performance, low-memory-footprint, single-file embedded database for key/value storage

LDBA - a fast, pure PHP, key-value database. Information LDBA is a high-performance, low-memory-footprint, single-file embedded database for key/value

Releases(v0.2.0)
Owner
李铭昕
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
李铭昕
Alerts users in the SilverStripe CMS when multiple people are editing the same page.

Multi-User Editing Alert Alerts users in the SilverStripe CMS when multiple people are editing the same page. Maintainer Contact Julian Seidenberg <ju

Silverstripe CMS 15 Dec 17, 2021
A collection of samples that demonstrate how to call Google Cloud services from PHP.

PHP Docs Samples A collection of samples that demonstrate how to call Google Cloud services from PHP. See our other Google Cloud Platform github repos

Google Cloud Platform 875 Dec 29, 2022
A collection of samples that demonstrate how to call Google Cloud services from PHP.

PHP Docs Samples A collection of samples that demonstrate how to call Google Cloud services from PHP. See our other Google Cloud Platform github repos

Google Cloud Platform 796 Dec 22, 2021
A cross-language remote procedure call(RPC) framework for rapid development of high performance distributed services.

Motan Overview Motan is a cross-language remote procedure call(RPC) framework for rapid development of high performance distributed services. Related

Weibo R&D Open Source Projects 5.8k Dec 20, 2022
Shiki is a beautiful syntax highlighter powered by the same language engine that many code editors use.

Shiki is a beautiful syntax highlighter powered by the same language engine that many code editors use. This package allows you to use Shiki from PHP.

Spatie 229 Jan 4, 2023
Share value objects that contain the same primitive value as a singleton

sharable-value-objects Share value objects that contain the same primitive value as a singleton. Singletons are kept under WeakReference objects. Inst

mpyw 5 Nov 14, 2021
A layout field that forces translations to have the same structure.

Kirby translatedlayout plugin A layout field that forces translations to have anidentical structure to the one of the default language. This is an exp

Daan de Lange 12 Apr 25, 2022
A Magento 2 module that allows for creating discrete PDP (Product Detail Pages) page layouts for customers landing on the site from a PPC (Pay Per Click) link/ad by allowing routing to the same pages using a `/ppc/` prefix in the URL path.

A Magento 2 module that allows for creating discrete PDP (Product Detail Pages) page layouts for customers landing on the site from a PPC (Pay Per Click) link/ad by allowing routing to the same pages using a `/ppc/` prefix in the URL path.

null 16 Nov 11, 2022
Easily decorate your method calls with laravel-decorator package

?? Laravel Decorator Decorator pattern in laravel apps Made with ❤️ for smart clean coders A try to port "decorator" feature from python language to l

Iman 126 Jan 1, 2023
Michael Pratt 307 Dec 23, 2022