Any plain key-value storage system is limited in the extent to which complex data can be stored since each key must be unique.
You can achieve namespacing by introducing a naming convention to the keys so different parts of your application could operate without clashing. However, sometimes this is not very practical when the attributes data is an array, for example a set of tokens.
Session variables solve this problem by storing user information to be used across multiple pages (e.g. By default, session variables last until the user closes the browser.
This is however just one application for flash messages.
For example, a user submits a form which hits an update controller, and after processing the controller redirects the page to either the updated page or an error page.
Flash messages set in the previous page request would be displayed immediately on the subsequent page load for that session.