blob: f3ad687bfd70072e6b801d0c3bb83204adc856c1 [file] [log] [blame]
Title: Configuring Caching Behavior
<P>Cayenne supports local and distributed caching of fetched data. The design of the caching feature is discussed in the User Guide. When a new DataDomain is created, it uses default caching settings - data is cached within JVM, but no remote synchronization is performed. User can change these settings depending on the target application deployment strategy.</P>
<H3><A name="ConfiguringCachingBehavior-NoCacheSharingConfiguration"></A>No Cache Sharing Configuration</H3>
<P>This type of configuration may result in somewhat faster commit operations, but is likely to lead to stale data when multiple users modify data in the same application. To disable any cache sharing uncheck &quot;Use Shared Cache&quot; checkbox. </P>
<H3><A name="ConfiguringCachingBehavior-LocalVMCacheSharingConfiguration"></A>Local VM Cache Sharing Configuration</H3>
<P>Default configuration for the new DataDomains. Ideal for applications that do not care about data being modified outside of the application. This configuration is acceptable for a lot of client-server and web applications.</P>
<H3><A name="ConfiguringCachingBehavior-CrossVMCacheSharingConfiguration"></A>Cross-VM Cache Sharing Configuration</H3>
<P>Configuration that allows to notify other applications about changes made by an application and to listen for such changes made by others. This type of configuration incurrs the most overhead, because it will constantly send and receive synchronization messages, but it is also the most powerful configuration. Cayenne currently supports the use of JMS and JavaGroups frameworks for synchronization, and also allows users to create their own transport mechanism. </P>
<DIV class="panelMacro"><TABLE class="noteMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="http://cayenne.apache.org/docs/1.2/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>Cayenne distribution archive does not include JavaGroups or JMS libraries. Those must be downloaded and installed separately. However until deployment phase, Cayenne does not require those libraries to be installed.</TD></TR></TABLE></DIV>
<P>To configure distributed cache sharing, check &quot;Remote Change Notifications&quot; checkbox, and click &quot;Configure&quot; button to select and configure the type of transport to use.</P>
<DIV class="panelMacro"><TABLE class="tipMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="http://cayenne.apache.org/docs/1.2/images/icons/emoticons/check.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>Synchronization is only done between remote DataDomains with the same name. Note that for JavaGroups configuration, a combination of multicast address and port must be unique for each DataDomain name.</TD></TR></TABLE></DIV>
<H3><A name="ConfiguringCachingBehavior-ChoosingJavaGroupsoverJMS"></A>Choosing JavaGroups over JMS</H3>
<P>JavaGroups is the most portable and flexible mechanism. At the minimum, JMS setup requires a JMS server running, and subjects for each of the DataDomains to be configured. JavaGroups is peer-to-peer library that is embedded into applications. Default configuration provided by CayenneModeler will work out of the box, provided that IP multicast is enabled on the network. </P>
<P>The conclusion is that using JMS is probably most appropriate when deploying within J2EE containers that alreay support this service, while JavaGroups can be used in almost any environment.</P>