cache files function