All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jpattern.service.cache.ehcache.EhCacheServiceConfig Maven / Gradle / Ivy

There is a newer version: 3.6.2
Show newest version
package com.jpattern.service.cache.ehcache;

import com.jpattern.service.cache.statistics.ICacheStatisticsManager;
import com.jpattern.service.cache.statistics.NullCacheStatisticsManager;

import net.sf.ehcache.CacheManager;

/**
 * 
 * @author Francesco Cina'
 *
 * 5 May 2011
 */
public class EhCacheServiceConfig implements IEhCacheServiceConfig {
	
	private CacheManager cacheManager;
	
	private ICacheStatisticsManager cacheStatisticsManager;

	public EhCacheServiceConfig() {
	}

	public EhCacheServiceConfig(CacheManager cacheManager, ICacheStatisticsManager cacheStatisticsManager) {
		this.cacheManager = cacheManager;
		this.cacheStatisticsManager = cacheStatisticsManager;
	}
	
	public void setCacheStatisticsManager(ICacheStatisticsManager cacheStatisticsManager) {
		this.cacheStatisticsManager = cacheStatisticsManager;
	}

	/* (non-Javadoc)
	 * @see eu.europa.ec.empl.eures.service.cache.ICacheManagerConfig#getCacheStatisticsManager()
	 */
	@Override
	public ICacheStatisticsManager getCacheStatisticsManager() {
		if (cacheStatisticsManager==null) {
			cacheStatisticsManager = new NullCacheStatisticsManager();
		}
		return cacheStatisticsManager;
	}

	public void setCacheManager(CacheManager cacheManager) {
		this.cacheManager = cacheManager;
	}

	/* (non-Javadoc)
	 * @see eu.europa.ec.empl.eures.service.cache.ICacheManagerConfig#getCacheManager()
	 */
	@Override
	public CacheManager getCacheManager() {
		return cacheManager;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy