db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Armin Waibel <arm...@apache.org>
Subject Re: FieldCache
Date Thu, 08 Jul 2004 07:53:41 GMT
Hi Brian,

this is exactly the same idea I had in mind (and in source before my 
hard disk crash ;-)) for the new second level cache. I use a helper 
class called SnapshotBuilder to generate Map based ObjectContainer 
classes (maps are based on field names).
The information about proxy references in ObjectContainer was stored 
indirectly. E.g. when the reference was 'null' (no referenced object) I 
skip the reference, thus ObjectContainer#getReferenceValue(String name) 
returns 'null'. If the reference exists but was an unmaterialized 
collection proxy an Identity array of length 0 was stored, thus 
ObjectContainer#getReferenceValue returns an array of length 0 to signal 
an unmaterialized proxy.
I started rewriting this stuff some weeks ago, it's far from complete, 
but if you interested I can send you the source.

By the way, the new caching on the second level discriminate between the 
preparation for cache and the caching of the object itself. The caching 
of the objects are done in ObjectCache implementations, the preparation 
for caching (means filtering of objects or not, preparation of objects, 
copying of objects or not, ...) is done in a class called CacheBroker 
(interface). Each ObjectCache has an associated CacheBroker. The 
CacheBroker implementation wraps the ObjectCache implementation. Both 
classes have to be threadsafe, because they will be shared by PB instances.
This isolate the caching logic from the real cache and make the 
ObjectCache implementations much more reusable.
The first level cache push all relevant objects to the CacheBroker, the 
CacheBroker prepares the objects for caching and cache them in ObjectCache.


Brian McCallister wrote:
> Tomorrow or this weekend I plan on implementing a field cache 
> implementation of ObjectCache. It won't hold instantiated objects, just 
> the field values, and structs for refs and collections a la:
> cache fields in ObjectEntry
>     references collection entries
>     maintains array of field values
>     maintains array of ReferenceEntry instances
>     maintains array of CollectionEntry instances
> cache collections in CollectionEntry
>     knows class it is supposed to really be
>     maintains array of Identity instances
> cache references in ReferenceEntry
>     holds identity of referenced object
> Need to handle case of proxies correctly
> Any thoughts before I implement will be appreciated.
> Using this effectively will require armin's TwoLevelCache so that you 
> get effectively PerBroker caching to handle circular refs, but outside 
> of that can use the field cache as the second level. This also makes 
> handling isolation easier without clone().
> -brian
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org

To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org

View raw message