FileLock
class FileLock implements FileLockInterface
File lock.
Traits
Methods
Construct file lock with file name and optional options bitmask and logger instance.
Assign the options bitmask to configure locking behavior.
Returns true if lock has been acquired.
Returns true if lock is shared.
Returns true if lock is exclusive.
Returns true if lock is blocking.
Returns true if lock is non blocking.
Returns true if file handle is held.
Returns the file handle.
Try to acquire a file lock.
Try to release a file lock.
Details
at line line 54
final
__construct(
string $file,
null|int $options = null,
LoggerInterface $logger = null)
Construct file lock with file name and optional options bitmask and logger instance.
at line line 69
final
setOptions(
int $options)
Assign the options bitmask to configure locking behavior.
at line line 87
final
bool
isAcquired()
Returns true if lock has been acquired.
at line line 97
final
bool
isShared()
Returns true if lock is shared.
at line line 107
final
bool
isExclusive()
Returns true if lock is exclusive.
at line line 117
final
bool
isBlocking()
Returns true if lock is blocking.
at line line 127
final
bool
isNonBlocking()
Returns true if lock is non blocking.
at line line 137
final
bool
hasResource()
Returns true if file handle is held.
at line line 147
final
resource
getResource()
Returns the file handle.
at line line 157
final
bool
acquire()
Try to acquire a file lock.
at line line 186
final
bool
release()
Try to release a file lock.