Save the cache atomically. (RhBug:1047087)