class Lock

Lock处理类提供统一的锁机制

Methods

static  Redis
getLocker( string|null $useCache = null)

获取Lock实例

static  Redis
setExpire( int $expire = 100)

设置锁的过期时间

static  mixed
lock( string $key, bool $wouldBlock = false)

上锁

static  void
unlock( string $key)

解锁

Details

at line line 25
static Redis getLocker( string|null $useCache = null)

获取Lock实例

Parameters

string|null $useCache 使用的锁的配置

Return Value

Redis | \Cml\Lock\Memcache | \Cml\Lock\File | false

at line line 37
static Redis setExpire( int $expire = 100)

设置锁的过期时间

Parameters

int $expire

Return Value

Redis | \Cml\Lock\Memcache | \Cml\Lock\File

at line line 50
static mixed lock( string $key, bool $wouldBlock = false)

上锁

Parameters

string $key 要解锁的锁的key
bool $wouldBlock 是否堵塞

Return Value

mixed

at line line 62
static void unlock( string $key)

解锁

Parameters

string $key

Return Value

void