Vacuum flask is designed in such way that it stops the movement of heat from inside to outside and outside to inside of flask both. In this flask, a glass or steel container is placed within another container made up of either plastic or steel and then, these two containers are adjoined together in such manner that it creates a vacuum between them after removing out the air from space. As we know, vacuum is a bad conducter of heat so it stops the transfer of heat from inside to outside of flask and vise versa.
Besides, the inner container of flask is made up of steel or silver-coated glass as both of them reflect the heat and keep it from moving out of the flask. In addition, an air-tight lid is used to prevent further transfer of heat as it tightly seals the flask-opening and doesn't permit air to move inside.
Such system maintains the temperature on it's actual for a long time and that's why liquids keep hot inside the flask for hours.