Codehaus     ExoLab     OpenEJB     OpenJMS     OpenORB     Castor     Tyrex     
 

Main
  Home
  About
  Features
  Download
  API
  Schema
  Castor Forums
  Mailing Lists
  CVS / JIRA
  Support
  CastorWiki
  RSS news feed

XML
  Using XML
  Source Generator
  Schema Support
  XML Mapping
  XML FAQ
  Custom Handlers

JDO
  Introduction
  Using JDO
  JDO Config
  Types
  JDO Mapping
  JDO FAQ
  JDO Examples
  JDO How-Tos
  Other Features

Advanced JDO
  OQL
  Trans. & Locks
  Design
  KeyGen
  Long Trans.
  Nested Attrs.
  Pooling Examples
  LOBs
  Best practice

More
  Presentations
  The Examples
  3rd Party Tools
  JDO Tests
  XML Tests
  Configuration
  Tips & Tricks
  Full JavaDoc
  CastorWiki
  
  

About
  License
  Contributors
  Marketplace
  Status, Todo
  Changelog
  Library
  Contact
  Project Name

  



How to use a (performance) cache with Castor


Intended Audience
Prerequisites
Steps
    Add <cache-type> element to class mapping
Tips
References


Intended Audience

Anyone who wants to enable caching for classes already mapped with Castor JDO.

This document addresses the basics to get people familiar with the basic concepts and discusses some implementation details.

The example given describes the addition of a <cache-type> element to an existing class mapping.

Prerequisites

You should have a valid class mapping for a Java class, similar to the following one:

<mapping>
    <class name="com.xyz.MyOtherObject" identity="id">
        <field name="id" type="integer">
               ...
        </field>
        <field name="description" type="string">
               ...
        </field>
    </class>
</mapping>
                

Steps

Here is how to proceed.

Add <cache-type> element to class mapping

Add a <cache-type> element as shown below, specifying the cache provider to use in the 'type' attribute.

<mapping>
    <class name="com.xyz.MyOtherObject" identity="id">
        <cache-type type="time-limited"/>
        <field name="id" type="integer">
               ...
        </field>
        <field name="description" type="string">
               ...
        </field>
    </class>
</mapping>
                

This, for example, defines the 'time-limited' cache provider to be used for the com.xyz.MyOtherObject. This cache provider applies internally a time-limited least-recently-used algorithm for com.xyz.MyObject instances

.

Tips

-With the current release, performance caches also serve a dual purpose as dirty checking caches for long-transactions. This limitation implies that the object's duration in the performance cache determines the allowed time span of a long transaction. This might become an issue when performance caches of type 'count-limited' or 'time-limited' are being used, as objects will eventually be disposed. If an application tries to update an object that has been disposed from the dirty checking cache, an ObjectModifedException will be thrown.

References

-Long transactions
-Caching
-Caching in clustered environments
 
   
  
   
 


Copyright © 1999-2005 ExoLab Group, Intalio Inc., and Contributors. All rights reserved.
 
Java, EJB, JDBC, JNDI, JTA, Sun, Sun Microsystems are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and in other countries. XML, XML Schema, XSLT and related standards are trademarks or registered trademarks of MIT, INRIA, Keio or others, and a product of the World Wide Web Consortium. All other product names mentioned herein are trademarks of their respective owners.