PHP 클래스 Cml\Lock

파일 보기 프로젝트 열기: linhecheng/cmlphp 1 사용 예제들

공개 메소드들

메소드 설명
getLocker ( string | null $useCache = null ) : Redis 获取Lock实例
lock ( string $key, boolean $wouldBlock = false ) : mixed 上锁
setExpire ( integer $expire = 100 ) : Redis 设置锁的过期时间
unlock ( string $key ) : void 解锁

메소드 상세

getLocker() 공개 정적인 메소드

获取Lock实例
public static getLocker ( string | null $useCache = null ) : Redis
$useCache string | null 使用的锁的配置
리턴 Cml\Lock\Redis | \Cml\Lock\Memcache | \Cml\Lock\File | false

lock() 공개 정적인 메소드

上锁
public static lock ( string $key, boolean $wouldBlock = false ) : mixed
$key string 要解锁的锁的key
$wouldBlock boolean 是否堵塞
리턴 mixed

setExpire() 공개 정적인 메소드

设置锁的过期时间
public static setExpire ( integer $expire = 100 ) : Redis
$expire integer
리턴 Cml\Lock\Redis | \Cml\Lock\Memcache | \Cml\Lock\File

unlock() 공개 정적인 메소드

解锁
public static unlock ( string $key ) : void
$key string
리턴 void