org.hibernate.cache
Class OSCacheProvider

java.lang.Object
  extended by org.hibernate.cache.OSCacheProvider
All Implemented Interfaces:
CacheProvider

public class OSCacheProvider
extends Object
implements CacheProvider

Support for OpenSymphony OSCache. This implementation assumes that identifiers have well-behaved toString() methods.

Author:
Mathias Bogaert

Field Summary
static String OSCACHE_CAPACITY
          The OSCache cache capacity property suffix.
static String OSCACHE_CRON
          The OSCache CRON expression property suffix.
static String OSCACHE_REFRESH_PERIOD
          The OSCache refresh period property suffix.
 
Constructor Summary
OSCacheProvider()
           
 
Method Summary
 Cache buildCache(String region, Properties properties)
          Builds a new Cache instance, and gets it's properties from the OSCache Config which reads the properties file (oscache.properties) from the classpath.
 boolean isMinimalPutsEnabledByDefault()
           
 long nextTimestamp()
          Generate a timestamp
 void start(Properties properties)
          Callback to perform any necessary initialization of the underlying cache implementation during SessionFactory construction.
 void stop()
          Callback to perform any necessary cleanup of the underlying cache implementation during SessionFactory.close().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OSCACHE_REFRESH_PERIOD

public static final String OSCACHE_REFRESH_PERIOD
The OSCache refresh period property suffix.

See Also:
Constant Field Values

OSCACHE_CRON

public static final String OSCACHE_CRON
The OSCache CRON expression property suffix.

See Also:
Constant Field Values

OSCACHE_CAPACITY

public static final String OSCACHE_CAPACITY
The OSCache cache capacity property suffix.

See Also:
Constant Field Values
Constructor Detail

OSCacheProvider

public OSCacheProvider()
Method Detail

buildCache

public Cache buildCache(String region,
                        Properties properties)
                 throws CacheException
Builds a new Cache instance, and gets it's properties from the OSCache Config which reads the properties file (oscache.properties) from the classpath. If the file cannot be found or loaded, an the defaults are used.

Specified by:
buildCache in interface CacheProvider
Parameters:
region -
properties -
Returns:
Throws:
CacheException

nextTimestamp

public long nextTimestamp()
Description copied from interface: CacheProvider
Generate a timestamp

Specified by:
nextTimestamp in interface CacheProvider

start

public void start(Properties properties)
           throws CacheException
Callback to perform any necessary initialization of the underlying cache implementation during SessionFactory construction.

Specified by:
start in interface CacheProvider
Parameters:
properties - current configuration settings.
Throws:
CacheException

stop

public void stop()
Callback to perform any necessary cleanup of the underlying cache implementation during SessionFactory.close().

Specified by:
stop in interface CacheProvider

isMinimalPutsEnabledByDefault

public boolean isMinimalPutsEnabledByDefault()
Specified by:
isMinimalPutsEnabledByDefault in interface CacheProvider


Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.