Download the PHP package pudongping/wise-locksmith without Composer

On this page you can find all versions of the php package pudongping/wise-locksmith. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wise-locksmith

wise-locksmith

[![Latest Stable Version](https://poser.pugx.org/pudongping/wise-locksmith/v/stable.svg)](https://packagist.org/packages/pudongping/wise-locksmith) [![Total Downloads](https://poser.pugx.org/pudongping/wise-locksmith/downloads.svg)](https://packagist.org/packages/pudongping/wise-locksmith) [![Latest Unstable Version](https://poser.pugx.org/pudongping/wise-locksmith/v/unstable.svg)](https://packagist.org/packages/pudongping/wise-locksmith) [![Minimum PHP Version](http://img.shields.io/badge/php-%3E%3D%207.1-8892BF.svg)](https://php.net/) [![Packagist](https://img.shields.io/packagist/v/pudongping/wise-locksmith.svg)](https://github.com/pudongping/wise-locksmith) [![License](https://poser.pugx.org/pudongping/wise-locksmith/license)](https://packagist.org/packages/pudongping/wise-locksmith)

English | 中文

:lock: A framework-agnostic mutex library designed to facilitate serialized execution of PHP code in high-concurrency scenarios.

Requirements

Installation

Quickstart

Usage

An example of potential data inconsistency in high-concurrency scenarios is provided in the current project, see here.

flock - File Lock

File locking has no dependencies. You can set the lock's timeout using the optional third parameter, in seconds (supports floating-point numbers, e.g., 1.5 means 1500ms, which means it will wait for a maximum of 1500ms; if it fails to acquire the lock, it will actively release the attempt and throw a Pudongping\WiseLocksmith\Exception\TimeoutException exception). Setting it to Pudongping\WiseLocksmith\Lock\File\Flock::INFINITE_TIMEOUT means it never expires, and it will continuously block attempting to acquire the lock until successful. The default value is Pudongping\WiseLocksmith\Lock\File\Flock::INFINITE_TIMEOUT.

redisLock - Distributed Lock

Requires the redis extension. You can set the lock's timeout using the optional third parameter, in seconds (supports floating-point numbers, e.g., 1.5 means 1500ms, which means it will wait for a maximum of 1500ms; if it fails to acquire the lock, it will actively release the attempt and throw a Pudongping\WiseLocksmith\Exception\TimeoutException exception). The default value is 5. The fourth parameter is a unique value for the current lock, which is generally not needed to be set unless there are special circumstances.

redLock - RedLock (Implementation of distributed locks in a Redis cluster environment)

The parameters required for setting up the redLock lock are identical to the redisLock lock, except for the first parameter. All other parameters are exactly the same. The redLock lock is a cluster implementation of the redisLock lock.

channelLock - Coroutine-Level Mutex Lock

When using this lock, you need to have the swoole extension installed, and the version must be greater than or equal to 4.5. You can set the lock's timeout using the optional third parameter, in seconds (supports floating-point numbers, e.g., 1.5 means 1500ms, which means it will wait for a maximum of 1500ms; if it fails to acquire the lock, it will actively give up the attempt and return false to indicate the lock was not acquired). Setting it to -1 means it never expires, and it will continuously block attempting to acquire the lock until successful. The default value is -1.

For all the mentioned locks, the business closure function is executed only after successfully acquiring the lock. It then returns the result of the business closure function's execution. Otherwise, if the lock is not acquired, the business closure function is not executed, and the return value is null.

Running tests

To run the test suite, clone this repository and then install dependencies via Composer.

Then, go to the project root and run:

Exception Handling

You can catch Pudongping\WiseLocksmith\Exception\WiseLocksmithException exceptions to capture all exceptions thrown by this library.

Acknowledgments

Contributing

Bug reports (and small patches) can be submitted via the issue tracker. Forking the repository and submitting a Pull Request is preferred for substantial patches.

License

MIT, see LICENSE file.


All versions of wise-locksmith with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
ext-redis Version *
psr/log Version ^1.0|^2.0|^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pudongping/wise-locksmith contains the following files

Loading the files please wait ....