[Dbix-class] Rows as singletons

Matt S Trout dbix-class at trout.me.uk
Sun Jul 20 01:09:03 BST 2008


On Tue, Jun 24, 2008 at 06:46:38PM +0100, David Cantrell wrote:
> I've been mumbling on IRC over the last week or two about rows being
> singletons when they get loaded into memory.  This is mostly because,
> when writing tests for a DBIx::Class based project I got irritated when
> I had two references to the same row hanging around in memory, update()d
> one of them, but the other still had old data in it.
> 
> Here's my fix:
>   http://www.cantrell.org.uk/david/private/SingletonRows.pm

This is probably something else that would work well with the ResultSource
refactor I just mentioned upthread wrt caching stuff.

Hm. Wouldn't you be better using the "keep weak refs and then clean 'em
up via a mark-and-sweep every so often" approach that CDBI's LiveObjectIndex
does? The whole refcounting thing seems like much more work, and maybe
even -more- fragile than the LOI used to be.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list