FileLock
in package
Table of Contents
Properties
Methods
- __construct() : mixed
- acquire() : bool
- Attempts to acquire a file lock. Returns true if successful, false if lock already exists.
- isLocked() : bool
- Checks if the lock is currently active.
- release() : void
- Releases the file lock by deleting the lock file.
Properties
$lockFile
private
string
$lockFile
$maxAge
private
int
$maxAge
Methods
__construct()
public
__construct(string $lockName[, int $maxAge = 1800 ]) : mixed
Parameters
- $lockName : string
- $maxAge : int = 1800
acquire()
Attempts to acquire a file lock. Returns true if successful, false if lock already exists.
public
acquire() : bool
Stale locks older than $maxAge seconds are automatically released.
Return values
bool —True if lock acquired, false if already locked.
isLocked()
Checks if the lock is currently active.
public
isLocked() : bool
Return values
bool —True if locked, false otherwise.
release()
Releases the file lock by deleting the lock file.
public
release() : void