[Dbix-class] Live object index support ported
Matt S Trout
dbix-class at trout.me.uk
Fri Jul 29 08:50:28 CEST 2005
I've ported the Class::DBI live object index into DBIx::Class as
::CDBICompat::LiveObjectIndex. Notable changes are -
It's wrapped round insert, _row_to_object and discard_changes, the former
to add new objects, the second to handle retrieved ones and the last to
fiddle around the re-retrieve overwriting the live objects entry.
The integration probably isn't perfect; notably if you use PK::Auto and the
module is before ::LiveObjectIndex in the inheritance chain your new inserts
won't get put in the index because they won't have a pk when ::LiveObjectIndex
sees them go past. I've re-ordered the ISA in Test::SQLite to reflect this.
While porting I made the index and the insert count class data rather than
lexicals - it seems cleaner and I thought it might be interesting to be able
to to localise the object index at any level in the hierarchy, although the
only use I can immediately think of is per-table sweep frequency tuning.
More tests would be appreciated, since the cdbi ones (or at least the ones
imported so far) seem to be a bit light on them. Failing test cases showing
where I've cocked something up would be fantastic :)
Matt S Trout Website: http://www.shadowcatsystems.co.uk
Technical Director E-mail: mst (at) shadowcatsystems.co.uk
Shadowcat Systems Ltd.
More information about the Dbix-class