[CDBI] Serializing a CDBI object

Bill Moseley moseley at hank.org
Wed May 2 16:01:42 BST 2007

I was looking at the Class::DBI::Storable module and noted that it
just stores the id and then does a retrieve on thaw.

I have the live object index disabled, so the justification for the
above module may not apply.

Serializing simple objects seems to work fine, so I'm curious if
there's any other issues to be aware of.

For one things, serializing objects that have, say, times that are
inflated to DateTime objects take up a lot more space when serialized.

Is there a better trick than to replace those with a DateTime strings
when freezing and then re-inflate when thawing?

I'm currently saving the user id in the session and then for each
request retrieving the user object again.  So, I'm curious to see what
it might take to save their object in the session to avoid the trip to
the database for every request.  In this situation it's ok to have stale
user data for the entire session.

Bill Moseley
moseley at hank.org

More information about the ClassDBI mailing list