[Twisted-Python] caching of row objects

Sean Riley sean at twistedmatrix.com
Sun Sep 8 17:17:50 EDT 2002


Currently, if an application loads a RowObject for a particular row twice,
it gets two instances that correspond to the same database row. this has the
potential to cause data errors as these instances don't know about each
other.

One solution is make the reflector know about all the rowObjects loaded
(they all have unique key identifiers from the db) and act as a factory -
passing out either new objects or already loaded objects instead of
duplicates.

This is pretty easy to do, but I'm not sure of the implications for cleaning
up RowObjects. Maybe refcounting of rowobjects to remove them from this
cache? Maybe an explicit "unload" or "unCache" object method on the
reflector?  any ideas?

----------------
"If he's so smart, then how come he's dead?", Homer Simspon
Sean Riley
sean at ninjaneering.com





More information about the Twisted-Python mailing list