org.castor.cache.distributed
Class OsCacheFactory<K,V>

java.lang.Object
  extended by org.castor.cache.distributed.OsCacheFactory<K,V>
Type Parameters:
K - the type of keys maintained by this cache
V - the type of cached values
All Implemented Interfaces:
CacheFactory<K,V>

public final class OsCacheFactory<K,V>
extends Object
implements CacheFactory<K,V>

Implements CacheFactory for the OsCache implementation of Cache.

Since:
1.0
Version:
$Revision: 9041 $ $Date: 2011-08-16 11:51:17 +0200 (Di, 16 Aug 2011) $
Author:
Werner Guttmann, Ralf Joachim

Constructor Summary
OsCacheFactory()
           
 
Method Summary
 Cache<K,V> getCache(ClassLoader classLoader)
          Instantiates an instance of the cache implementation this factory is responsible for using the given classloader.
 Cache<K,V> getCache(String implementation, ClassLoader classLoader)
          Normally called to initialize OsCache.
 String getCacheClassName()
          Returns the full class name of the underlying cache implementation.
 String getCacheType()
          Returns the short alias cache type for this factory instance.
 void shutdown()
          Allows for cache-specific shutdown operations and resource cleanup.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OsCacheFactory

public OsCacheFactory()
Method Detail

getCache

public Cache<K,V> getCache(ClassLoader classLoader)
                    throws CacheAcquireException
Instantiates an instance of the cache implementation this factory is responsible for using the given classloader.

Specified by:
getCache in interface CacheFactory<K,V>
Parameters:
classLoader - A ClassLoader instance.
Returns:
A Cache instance.
Throws:
CacheAcquireException - Problem instantiating a cache instance.

getCache

public Cache<K,V> getCache(String implementation,
                           ClassLoader classLoader)
                    throws CacheAcquireException
Normally called to initialize OsCache. To be able to test the method without having com.opensymphony.oscache.general.GeneralCacheAdministrator implementation, it can also be called with a test implementations classname.

Parameters:
implementation - Cache implementation classname to initialize.
classLoader - A ClassLoader instance.
Returns:
A Cache instance.
Throws:
CacheAcquireException - Problem instantiating a cache instance.

getCacheType

public String getCacheType()
Returns the short alias cache type for this factory instance.

Specified by:
getCacheType in interface CacheFactory<K,V>
Returns:
The short alias cache type.

getCacheClassName

public String getCacheClassName()
Returns the full class name of the underlying cache implementation.

Specified by:
getCacheClassName in interface CacheFactory<K,V>
Returns:
The full cache class name.

shutdown

public void shutdown()
Allows for cache-specific shutdown operations and resource cleanup.

Specified by:
shutdown in interface CacheFactory<K,V>


Copyright © 2012. All Rights Reserved.