refactored cache file access