Only write cache if there was a change, test it