Add thread safety to snapshot cache