fix repeat write cache file issue