class
Illuminate
/
Cache
/
Lock
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.
abstract
Lock
Implements
Uses
Properties
protected
$name string
The name of the lock.
Default: null
protected
$seconds int
The number of seconds the lock should be maintained.
Default: null
protected
$owner string
The scope identifier of this lock.
Default: null
protected
$sleepMilliseconds int
The number of milliseconds to wait before re-attempting to acquire a lock while blocking.
Default: 250
Methods
public
__construct ( $name , $seconds , $owner ) : void
Create a new lock instance.
Parameters
- $name string
- $seconds int
- $owner string|null
public
abstract
acquire ( ) : bool
Attempt to acquire the lock.
public
abstract
release ( ) : bool
Release the lock.
protected
abstract
getCurrentOwner ( ) : string
Returns the owner value written into the driver for this lock.
public
get ( $callback ) : mixed
Attempt to acquire the lock.
Parameters
- $callback callable|null
public
block ( $seconds , $callback ) : mixed
Attempt to acquire the lock for the given number of seconds.
Parameters
- $seconds int
- $callback callable|null
public
owner ( ) : string
Returns the current owner of the lock.
protected
isOwnedByCurrentProcess ( ) : bool
Determines whether this lock is allowed to release the lock in the driver.
public
betweenBlockedAttemptsSleepFor ( $milliseconds ) : $this
Specify the number of milliseconds to sleep in between blocked lock acquisition attempts.
Parameters
- $milliseconds int