[CDBI] Re: Serializing a CDBI object

Bill Moseley moseley at hank.org
Wed May 2 17:43:47 BST 2007


On Wed, May 02, 2007 at 12:31:57PM -0400, Edward J. Sabol wrote:
> Bill Moseley wrote:
> > 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.
> 
> Are you using mod_perl? If so, I think just storing the user object in
> $r->pnotes() would be a lot easier...
> 
> http://perl.apache.org/docs/2.0/api/Apache2/RequestUtil.html#C_pnotes_
> 
> But I guess that wouldn't be shared across multiple Apache child processes.
> What method are you thinking of using? Memcached?

Well, I was trying to ignore the store in this question at this point
-- could be memcached or BerkeleyDB or something else.

I'm more curious about the issues dealing with freezing and thawing
CDBI objects.  Specifically how to make sure I'm not storing more than
needed and if there are other "gotchas" to be aware of.  For example,
deflating and inflating DateTime object when serializing.

-- 
Bill Moseley
moseley at hank.org




More information about the ClassDBI mailing list