Nette\Caching\Storages\FileStorage::lock PHP Method

lock() public method

Prevents item reading and writing. Lock is released by write() or remove().
public lock ( $key ) : void
return void
    public function lock($key)
    {
        $cacheFile = $this->getCacheFile($key);
        if ($this->useDirs && !is_dir($dir = dirname($cacheFile))) {
            @mkdir($dir);
            // @ - directory may already exist
        }
        $handle = fopen($cacheFile, 'c+b');
        if ($handle) {
            $this->locks[$key] = $handle;
            flock($handle, LOCK_EX);
        }
    }