[Twisted-Python] caching of row objects

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@ninjaneering.com

On Sun, 8 Sep 2002 16:17:50 -0500, "Sean Riley" <sean@twistedmatrix.com> wrote:
It sounds like this is a job for weak references. We can use those, now that we require Python 2.1 at minimum :). Take a look at the docs for the "weakref" module. -- | <`'> | Glyph Lefkowitz: Traveling Sorcerer | | < _/ > | Lead Developer, the Twisted project | | < ___/ > | http://www.twistedmatrix.com |

On Sun, 8 Sep 2002 16:17:50 -0500, "Sean Riley" <sean@twistedmatrix.com> wrote:
It sounds like this is a job for weak references. We can use those, now that we require Python 2.1 at minimum :). Take a look at the docs for the "weakref" module. -- | <`'> | Glyph Lefkowitz: Traveling Sorcerer | | < _/ > | Lead Developer, the Twisted project | | < ___/ > | http://www.twistedmatrix.com |
participants (2)
-
Glyph Lefkowitz
-
Sean Riley