clear permissions cache when scanning a file
Do not recheck $cacheData. Move if($reuseExisting) under if($cacheData).