PRODUCTS AND SERVICES INDUSTRIES SUPPORT PARTNERS COMMUNITIES ABOUT
  Coherence 3.4 User Guide
  Cache Semantics
Added by Rob Misek, last edited by Rob Misek on Sep 15, 2008  (view change)

Labels

 

Use Coherence caches to cache value objects. These objects may represent data from any source, either internal (suchas session data, transient data, and so on) or external (such as a database, mainframe, and so on).

Objects placed in the cache must be serializable. The simplest approach to doing this is to implement java.io.Serializable. For higher performance, Coherence also supports the java.io.Externalizable and (even faster) com.tangosol.io.ExternalizableLite interfaces. The primary difference between Externalizable and ExternalizableLite is the I/O stream used. In most cases, porting from one to the other is simple.

Any objects that implement com.tangosol.run.xml.XmlBean will automatically support ExternalizableLite. For more details, see the API Javadoc for XmlBean.

Remember, when serializing an object, Java serialization automatically crawls every visible object (via object references, including collections like Map and List). As a result, cached objects should not refer to their parent objects directly (holding onto an identifying value like an integer is okay).

Objects that implement their own serialization routines are not affected.