class Lock

Methods

__construct(Factory $redis)

Create a Horizon lock manager.

void
with(string $key, Closure $callback, int $seconds = 60)

Execute the given callback if a lock can be acquired.

bool
exists(string $key)

Determine if a lock exists for the given key.

bool
get(string $key, int $seconds = 60)

Attempt to get a lock for the given key.

void
release(string $key)

Release the lock for the given key.

connection()

Get the Redis connection instance.

Details

at line 20
__construct(Factory $redis)

Create a Horizon lock manager.

Parameters

Factory $redis

the Redis factory implementation

at line 28
void with(string $key, Closure $callback, int $seconds = 60)

Execute the given callback if a lock can be acquired.

Parameters

string $key
Closure $callback
int $seconds

Return Value

void

at line 38
bool exists(string $key)

Determine if a lock exists for the given key.

Parameters

string $key

Return Value

bool

at line 46
bool get(string $key, int $seconds = 60)

Attempt to get a lock for the given key.

Parameters

string $key
int $seconds

Return Value

bool

at line 56
void release(string $key)

Release the lock for the given key.

Parameters

string $key

Return Value

void

at line 76
RedisProxy connection()

Get the Redis connection instance.

Return Value

RedisProxy