All Projects → ronnylt → Redlock Php

ronnylt / Redlock Php

Licence: mit
Redis distributed locks in PHP

Projects that are alternatives of or similar to Redlock Php

Redisson
Redisson - Redis Java client with features of In-Memory Data Grid. Over 50 Redis based Java objects and services: Set, Multimap, SortedSet, Map, List, Queue, Deque, Semaphore, Lock, AtomicLong, Map Reduce, Publish / Subscribe, Bloom filter, Spring Cache, Tomcat, Scheduler, JCache API, Hibernate, MyBatis, RPC, local cache ...
Stars: ✭ 17,972 (+2660.68%)
Mutual labels:  lock, redis, distributed
Pottery
Redis for humans. 🌎🌍🌏
Stars: ✭ 204 (-68.66%)
Mutual labels:  lock, redis, distributed
Redislock
Simplified distributed locking implementation using Redis
Stars: ✭ 370 (-43.16%)
Mutual labels:  lock, redis, distributed
Foundatio
Pluggable foundation blocks for building distributed apps.
Stars: ✭ 1,365 (+109.68%)
Mutual labels:  lock, redis, distributed
Javainterview
java中高级基础指南
Stars: ✭ 222 (-65.9%)
Mutual labels:  lock, redis
Ninja Mutex
Mutex implementation for PHP
Stars: ✭ 180 (-72.35%)
Mutual labels:  lock, redis
slow-down
A centralized Redis-based lock to help you wait on throttled resources
Stars: ✭ 21 (-96.77%)
Mutual labels:  lock, distributed
Redsync.go
*DEPRECATED* Please use https://gopkg.in/redsync.v1 (https://github.com/go-redsync/redsync)
Stars: ✭ 292 (-55.15%)
Mutual labels:  redis, distributed
Live Mutex
High-performance networked mutex for Node.js libraries.
Stars: ✭ 118 (-81.87%)
Mutual labels:  lock, redis
Lock
高性能分布式并发锁, 行为限流
Stars: ✭ 260 (-60.06%)
Mutual labels:  lock, redis
Summer
这是一个支持分布式和集群的java游戏服务器框架,可用于开发棋牌、回合制等游戏。基于netty实现高性能通讯,支持tcp、http、websocket等协议。支持消息加解密、攻击拦截、黑白名单机制。封装了redis缓存、mysql数据库的连接与使用。轻量级,便于上手。
Stars: ✭ 336 (-48.39%)
Mutual labels:  redis, distributed
Aioredlock
🔒 The asyncio implemetation of Redis distributed locks
Stars: ✭ 171 (-73.73%)
Mutual labels:  lock, redis
Redlock Rb
Redlock is a redis-based distributed lock implementation in Ruby
Stars: ✭ 385 (-40.86%)
Mutual labels:  lock, redis
Haipproxy
💖 High available distributed ip proxy pool, powerd by Scrapy and Redis
Stars: ✭ 4,993 (+666.97%)
Mutual labels:  redis, distributed
distlock
The universal component of distributed locks in golang , support redis and postgresql
Stars: ✭ 60 (-90.78%)
Mutual labels:  lock, distributed
Easy
开源的Java开发脚手架,工作经验总结,springboot,springcloud,基于tk-mybatis代码反向生成,基于redis(redisson)注解形式加分布式锁等,计划将用该脚手架抄袭jeesite和ruoyi还有基于vue的后台权限管理系统做一套开源的后台管理和cms系统,域名服务器已买好,脚手架还在继续更新中,更新完毕开始更新easysite
Stars: ✭ 160 (-75.42%)
Mutual labels:  lock, redis
Spring Boot Start Current
Spring Boot 脚手架 Mybatis Spring Security JWT 权限 Spring Cache + Redis
Stars: ✭ 246 (-62.21%)
Mutual labels:  redis, distributed
Spring Boot Klock Starter
基于redis的分布式锁组件,简单方便快捷接入项目,使项目拥有分布式锁能力
Stars: ✭ 546 (-16.13%)
Mutual labels:  lock, redis
Diplomat
A HTTP Ruby API for Consul
Stars: ✭ 358 (-45.01%)
Mutual labels:  lock, distributed
Scrapy Redis
Redis-based components for Scrapy.
Stars: ✭ 4,998 (+667.74%)
Mutual labels:  redis, distributed

RedLock – Redis distributed locks in PHP

Based on Redlock-rb by Salvatore Sanfilippo

This library implements the Redis-based distributed lock manager algorithm described in this blog post.

To create a lock manager:

$servers = [
    ['127.0.0.1', 6379, 0.01],
    ['127.0.0.1', 6389, 0.01],
    ['127.0.0.1', 6399, 0.01],
];

$redLock = new RedLock($servers);

To acquire a lock:

$lock = $redLock->lock('my_resource_name', 1000);

Where the resource name is an unique identifier of what you are trying to lock and 1000 is the number of milliseconds for the validity time.

The returned value is false if the lock was not acquired (you may try again), otherwise an array representing the lock is returned, having three keys:

Array
(
    [validity] => 9897.3020019531
    [resource] => my_resource_name
    [token] => 53771bfa1e775
)
  • validity, an integer representing the number of milliseconds the lock will be valid.
  • resource, the name of the locked resource as specified by the user.
  • token, a random token value which is used to safe reclaim the lock.

To release a lock:

    $redLock->unlock($lock)

It is possible to setup the number of retries (by default 3) and the retry delay (by default 200 milliseconds) used to acquire the lock.

The retry delay is actually chosen at random between $retryDelay / 2 milliseconds and the specified $retryDelay value.

Disclaimer: As stated in the original antirez's version, this code implements an algorithm which is currently a proposal, it was not formally analyzed. Make sure to understand how it works before using it in your production environments.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].