oscache / docs / hibernate.html

<html>
    <head>
        <title>OSCache and Hibernate</title>
    </head>

    <body>

        <p><a href="http://www.hibernate.org">Hibernate</a> is a powerful, ultra-high
        performance object/relational persistence and query service for Java.
        Hibernate lets you develop persistent objects following common Java idiom -
        including association, inheritance, polymorphism, composition and the Java
        collections framework. Extremely fine-grained, richly typed object models
        are possible.</p>
        
        <p>Hibernate 2.1 features support for plugin cache providers and is 
        designed to integrate with distributed caches (2.1 also implements more 
        aggressive use of the cache). 
        <b>net.sf.hibernate.cache.CacheProvider</b> is the extension point for 
        user-defined cache integration.</p>
        
        <p><a href="http://www.hibernate.org/6.html">Hibernate 2.1.1</a> or 
        higher is required.</p>        
        
        <h3>hibernate.cache.provider_class</h3>

        <p>OSCache and Hibernate 2.1 integrate though <b>OSCacheProvider</b>. To 
        enable OSCache in Hibernate's configuration, add the following line to 
        hibernate.cfg.xml:</p>

<pre>
&lt;property name="hibernate.cache.provider_class"&gt;<b>net.sf.hibernate.cache.OSCacheProvider</b>&lt;/property&gt;
</pre>

        <p>The default refresh period is 
        <a href="http://www.opensymphony.com/oscache/api/com/opensymphony/oscache/base/CacheEntry.html#INDEFINITE_EXPIRY">CacheEntry.INDEFINITE_EXPIRY</a>.
        The first time a cacheable query is done, the cache has no effect on 
        speed. On the second and successive queries, the cache will be populated 
        and available to be hit.</p>
        
        <p>NOTE: object identifiers must have well-behaved <tt>toString()</tt> methods.</p>

        <h3>Configuration</h3>

        <p>To modify the refresh period, CRON expression or maximum cache 
        capacity, add the region configuration to your oscache.properties file, 
        as demonstrated below:</p>
        
<pre>
com.mypackage.model.Customer.refresh.period = 4000
com.mypackage.model.Customer.cron = * * 31 Feb *
com.mypackage.model.Customer.capacity = 500
</pre>

        <p>The <code>com.mypackage.model.Customer</code> is Hibernate's internal 
        <b>cache region</b>, which defaults to the classname, but which can be 
        specified in the Hibernate mapping files (region attribute of class-
        cache element or collection-cache element).</p>

    </body>
</html>
        
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.