protected function readCacheFile(string $cacheEntryPathAndFilename, int $offset = null, int $maxlen = null)
    {
        for ($i = 0; $i < 3; $i++) {
            $data = false;
            try {
                $file = fopen($cacheEntryPathAndFilename, 'rb');
                if ($file === false) {
                    continue;
                }
                if (flock($file, LOCK_SH) !== false) {
                    if ($offset !== null) {
                        fseek($file, $offset);
                    }
                    $data = fread($file, $maxlen !== null ? $maxlen : filesize($cacheEntryPathAndFilename) - (int)$offset);
                    flock($file, LOCK_UN);
                }
                fclose($file);
            } catch (\Exception $e) {
            }

            if ($data !== false) {
                return $data;
            }
            usleep(rand(10, 500));
        }

        return false;
    }
protected function readCacheFile(string $cacheEntryPathAndFilename, int $offset = null, int $maxlen = null)
    {
        for ($i = 0; $i < 3; $i++) {
            $data = false;
            try {
                $file = fopen($cacheEntryPathAndFilename, 'rb');
                if ($file === false) {
                    continue;
                }
                if (flock($file, LOCK_SH) !== false) {
                    if ($offset !== null) {
                        fseek($file, $offset);
                    }
                    $data = fread($file, $maxlen !== null ? $maxlen : filesize($cacheEntryPathAndFilename) - (int)$offset);
                    flock($file, LOCK_UN);
                }
                fclose($file);
            } catch (\Exception $e) {
            }

            if ($data !== false) {
                return $data;
            }
            usleep(rand(10, 500));
        }

        return false;
    }
protected function readCacheFile ( string $ cacheEntryPathAndFilename , int $ offset = null , int $ maxlen = null ) { for ( $ i = 0 ; $ i < 3 ; $ i ++ ) { $ data = false ; try { $ file = fopen ( $ cacheEntryPathAndFilename , 'rb' ) ; if ( $ file === false ) { continue ; } if ( flock ( $ file , LOCK_SH ) !== false ) { if ( $ offset !== null ) { fseek ( $ file , $ offset ) ; } $ data = fread ( $ file , $ maxlen !== null ? $ maxlen : filesize ( $ cacheEntryPathAndFilename ) - ( int ) $ offset ) ; flock ( $ file , LOCK_UN ) ; } fclose ( $ file ) ; } catch ( \ Exception $ e ) { } if ( $ data !== false ) { return $ data ; } usleep ( rand ( 10 , 500 ) ) ; } return false ; }
Reads the cache data from the given cache file, using locking.

@param string $cacheEntryPathAndFilename
@param int|null $offset
@param int|null $maxlen
@return boolean|string The contents of the cache file or false on error
Reads the cache data from the given cache file using locking .