вторник, 23 октября 2007 г.

Какую информацию стоит хранить в session


Marshalling/Unmarshalling the object from/to the session
with every hit is more expensive than simply querying the database. Add
to that the extra code you've got to add everywhere to make sure that
the session[:member] stays current with it's twin in the database, and
that if you ever change the internal structure of Member, that you've
got to remember to blow away all the sessions when you deploy the new
version, etc, etc.

Отсюда

Т.е. есть мнение, что быстрей хранить в сессии id и запрашивать БД, нежели хранить в сессии объект с несколькими нужными полями и каждый раз его десериализовывать.
Еще аргумент - при некоторых изменениях будут хериться все сессии.

1 комментарий:

legrus комментирует...

Теперь и я дочитал до аналогичного в книжке:)