refactor and test SKIP_CACHE logic