FileDocCategorySizeDatePackage
OSCacheProvider.javaAPI DocHibernate 3.2.52613Sat Feb 12 00:19:50 GMT 2005org.hibernate.cache

OSCacheProvider

public class OSCacheProvider extends Object implements CacheProvider
Support for OpenSymphony OSCache. This implementation assumes that identifiers have well-behaved toString() methods.
author
Mathias Bogaert

Fields Summary
public static final String
OSCACHE_REFRESH_PERIOD
The OSCache refresh period property suffix.
public static final String
OSCACHE_CRON
The OSCache CRON expression property suffix.
public static final String
OSCACHE_CAPACITY
The OSCache cache capacity property suffix.
private static final Properties
OSCACHE_PROPERTIES
Constructors Summary
Methods Summary
public CachebuildCache(java.lang.String region, java.util.Properties properties)
Builds a new {@link Cache} instance, and gets it's properties from the OSCache {@link Config} which reads the properties file (oscache.properties) from the classpath. If the file cannot be found or loaded, an the defaults are used.

param
region
param
properties
return
throws
CacheException


	                                            	 
	        

		int refreshPeriod = PropertiesHelper.getInt(
			StringHelper.qualify(region, OSCACHE_REFRESH_PERIOD),
			OSCACHE_PROPERTIES,
			CacheEntry.INDEFINITE_EXPIRY
		);
		String cron = OSCACHE_PROPERTIES.getProperty( StringHelper.qualify(region, OSCACHE_CRON) );

		// construct the cache
		final OSCache cache = new OSCache(refreshPeriod, cron, region);

		Integer capacity = PropertiesHelper.getInteger( StringHelper.qualify(region, OSCACHE_CAPACITY), OSCACHE_PROPERTIES );
		if ( capacity!=null ) cache.setCacheCapacity( capacity.intValue() );

		return cache;
	
public booleanisMinimalPutsEnabledByDefault()

		return false;
	
public longnextTimestamp()

		return Timestamper.next();
	
public voidstart(java.util.Properties properties)
Callback to perform any necessary initialization of the underlying cache implementation during SessionFactory construction.

param
properties current configuration settings.

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