This is great! Just a few questions.

>   We could create a value object for this table called BookVObj that has variable 
>with the 
>   same names as the table columns that might look like this:

Should value objects be immutable? I've been thinking about freezing
them after they are added to the cache. I worry that once and object is
in the cache it could be shared between any number of threads, so
contention becomes an issue. For simplicity one might just create a new
value object and replace the old one in the cache with it. Is this how
you do things or do you have a different strategy?

>       /**
>        * Stores BookVObj's in database.  Clears old items and caches new.
>        * 
>        */
>       public int storeBookVObj( BookVObj vObj ) {
>   
>           try {
>                   
>                // since any cached data is no longer valid, we should 
>               // remove the item from the cache if it an update.
>               if ( vObj.book_id_pk != 0 ) {
>                   bookCache.remove( "BookVObj" + vObj.book_id_pk );
>               }

Is this (the removal) necessary? I would think that the put that follows
would cause the object to be replaced, and that invalidation would
propagate to any remote / lateral caches. ( As a nice secondary effect,
removing this makes this method exactly the same as the code that stores
the object in loadVObj, nice bit of refactoring potential =)
               
-- jt




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to