Class LockingFilesystem
Class that performs a locking file read/write operation.
The object will add a file lock before writing and release it right after the
contents have been written. This can be used to prevent corruption of data
when multiple requests try to write to the same file at the same time.
Methods summary
public
string
|
#
read( string $path, boolean $blocking = false )
Read from a file.
Parameters
- $path
- Path to the file.
- $blocking
Wait for other locks to expire rather than
throwing an error when a lock cannot be aquired.
Returns
string
Throws
|
public
|
#
write( string $path, string $contents, boolean $blocking = false )
Write to the file.
Parameters
- $path
- Path to the file.
- $contents
- Contents to write to the file.
- $blocking
Wait for other locks to expire rather than
throwing an error when a lock cannot be aquired.
Throws
|