PHPackages                             socloz/ninja-mutex - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. socloz/ninja-mutex

ActiveLibrary[Database &amp; ORM](/categories/database)

socloz/ninja-mutex
==================

Simple to use mutex implementation that can use flock, memcache, memcached, mysql or redis for locking

0.2.0(13y ago)130.3kMITPHPPHP &gt;=5.3.0

Since Feb 21Pushed 11y ago11 watchersCompare

[ Source](https://github.com/SoCloz/ninja-mutex)[ Packagist](https://packagist.org/packages/socloz/ninja-mutex)[ Docs](https://github.com/arvenil/ninja-mutex)[ RSS](/packages/socloz-ninja-mutex/feed)WikiDiscussions socloz-master Synced 1mo ago

READMEChangelogDependencies (1)Versions (6)Used By (0)

About
-----

[](#about)

ninja-mutex is a simple to use mutex implementation for php. It supports different adapters (flock, memcache, mysql, redis, ...) so you can setup it as you wish. All adapters (if set up properly) can be used in multi server environment - in other words lock is shared between web servers.

Usage
-----

[](#usage)

### Mutex

[](#mutex)

First you need to choose adapter and setup it properly. For example if you choose flock implementation first you need to setup NFS filesystem and mount it on web servers. In this example we will choose memcache adapter:

```
