This implements the instance caching in SQLObject. Caching is
relatively aggressive. All objects are retained so long as they are
in memory, by keeping weak references to objects. We also keep other
objects in a cache that doesn't allow them to be garbage collected
(unless caching is turned off).