views:

43

answers:

2

Basically in my website I have a sidebar with a stack of boxes; each box can be collapsed or expanded by the user. I need to save the status of each box for the currently logged in user. I don't want to use cookies because if an user changes browser or computer, all the boxes will go to the default status.

Should I save this information on the database making a query every time the user collapses/expands a box? How would you handle this? Thanks.

Edit: What if an user clicks on the toggle button repeatedly, like ten times in two seconds, just because he enjoys the boxes' animation? He will make ten queries in two seconds. So maybe the question should be: when should I save this data?

+1  A: 

If you need to persist these options from multiple computers you will need some form of server side storage.

This could be database or flat file. The choice depends on what you have available, skill set, and the need to scale. If you are going to have just a few users, a flat file may be your best choice.

Dustin Laine
Dustin Laine: thanks, I edited my question.
Brainfeeder