Agile Rails - How long does the Depot application hold onto

I’m walking through the wonderful “Agile Web D. for Rails”
and in Chapter 8 on page 95 they build a Session model that has a
physical table in the database and a “Cart” array that’s linked to the
unique Session id.
So if the session key was an integer 123 the cart array must have a
‘foreign key’ value for the session_id = 123.
The session is a ‘real’ database table in the MySQL database while the
cart is an array that’s linked by it’s ‘foreign key’ named session_id.
(This is the only way I can figure that it can hold the array?)
My question is: This thing is stateless anyway…when (or does it
ever) is the Cart array DUMPED from memory?
Is it when the user logs off his browser?
Is it after a certain time defined by the program?
Is it after a certain time defined by the browser?
What mechanism eventually dumps this array?
Thank you,
David

On Mar 7, 2007, at 12:29 PM, BraveDave wrote:

The session is a ‘real’ database table in the MySQL database while the
cart is an array that’s linked by it’s ‘foreign key’ named session_id.
(This is the only way I can figure that it can hold the array?)
My question is: This thing is stateless anyway…when (or does it
ever) is the Cart array DUMPED from memory?
Is it when the user logs off his browser?
Is it after a certain time defined by the program?
Is it after a certain time defined by the browser?
What mechanism eventually dumps this array?

At the end of each request, all references to it disappear, and Ruby
will eventually garbage collect it.

A new cart object is constructed for every incoming request on the
session.

Cheers

Dave