Session in DB

Hi,

what is the advantage of storing the session in the database. Do I need to make special changes to use the CDbHttpSession and can later simply use the Yii::app()->session->itemAt('item') command to read data?

Thanx.

Storing session in database gives you more control and could potentially improve performance.

No, other than configuring 'session' component to be CDbHttpSession in app config, you don't need to make any special changes in your application code. In fact, you can freely switch to use different session storage without touching your other code.

A database using automatically makes me a story created sessions or not?

I don’t understand you. ;)

If you use CDbHttpSession, your session data will automatically be stored in database.

Yes, but will I have the information, for example, from 2 months?

Sorry for the confusion…

Sorry, i don't understand…

I mean, if I saved to session some value I will have it available after two months?

Data at the end of the session are stored in the database or are deleted?

Perhaps this is a strange question but if the session is saved to the database then all entries that were made will be available?

It depends on how you set the session expiration parameter. Please refer to PHP session documentation. CDbHttpSession will remove those expired data.

Thanks for the clarification of the topic and sorry for lack of knowledge of the session in PHP.