[CDBI] Serializing a CDBI object

Perrin Harkins perrin at elem.com
Thu May 3 12:02:43 BST 2007


On 5/2/07, Bill Moseley <moseley at hank.org> wrote:
> Serializing simple objects seems to work fine, so I'm curious if
> there's any other issues to be aware of.

If there's nothing in the objects that won't serialize (DBI
connections, closures), you should be able to do it.  The main issue
is that your object will be out of syn with the database, so you would
miss any updates done from other places.  There's also the possibility
that the cost of serialization and dumping to your session storage
will be the same as the cost of fetching the object from the db.

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

That surprises me.  DateTime has specific Storable hooks to address
this problem.

- Perrin



More information about the ClassDBI mailing list