Package net.sf.ehcache.constructs
Class CacheDecoratorFactory
- java.lang.Object
-
- net.sf.ehcache.constructs.CacheDecoratorFactory
-
- Direct Known Subclasses:
ReadThroughCacheFactory,RefreshAheadCacheFactory
public abstract class CacheDecoratorFactory extends java.lang.ObjectAn abstract factory for creating decorated Ehcache instances. Implementing classes should provide their own concrete factory extending this factory.- Author:
- Abhishek Sanoujam
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDASHDash string : "-"
-
Constructor Summary
Constructors Constructor Description CacheDecoratorFactory()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract EhcachecreateDecoratedEhcache(Ehcache cache, java.util.Properties properties)Creates a decoratedEhcacheusing the properties specified for configuring the decorator.abstract EhcachecreateDefaultDecoratedEhcache(Ehcache cache, java.util.Properties properties)This method is called when the factory is specified for the defaultCache in the config.static java.lang.StringgenerateDefaultDecoratedCacheName(Ehcache cache, java.lang.String cacheNameSuffix)Utility method to generate name of decorated cache to be created using factory specified in defaultCache.
-
-
-
Field Detail
-
DASH
public static final java.lang.String DASH
Dash string : "-"- See Also:
- Constant Field Values
-
-
Method Detail
-
createDecoratedEhcache
public abstract Ehcache createDecoratedEhcache(Ehcache cache, java.util.Properties properties)
Creates a decoratedEhcacheusing the properties specified for configuring the decorator.If the returned decorated cache has the same name as the underlying cache, then the original cache will be replaced by this new decorated cache in the CacheManager.
- Parameters:
cache- a reference to the owning cacheproperties- implementation specific properties configured as delimiter separated name value pairs in ehcache.xml- Returns:
- a decorated Ehcache
-
createDefaultDecoratedEhcache
public abstract Ehcache createDefaultDecoratedEhcache(Ehcache cache, java.util.Properties properties)
This method is called when the factory is specified for the defaultCache in the config. Create the decoratedEhcacheusing the properties specified.If the returned decorated cache has the same name as the underlying cache, then the original cache will be replaced by this new decorated cache in the CacheManager.
- Parameters:
cache- a reference to the owning cacheproperties- implementation specific properties configured as delimiter separated name value pairs in ehcache.xml- Returns:
- a decorated Ehcache
-
generateDefaultDecoratedCacheName
public static java.lang.String generateDefaultDecoratedCacheName(Ehcache cache, java.lang.String cacheNameSuffix)
Utility method to generate name of decorated cache to be created using factory specified in defaultCache.- Parameters:
cache- the underlying cachecacheNameSuffix- Name to be used as suffix. This is normally provided as a property in the decorator config properties. If this parameter is null or empty string, cache.getName() is returned- Returns:
- Name to be used for the new decorated cache in the form of cache.getName() + "-" + cacheNameSuffix or cache.getName() if cacheNameSuffix is null
-
-