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

com.wadpam.open.cache.EhCacheFactory Maven / Gradle / Ivy

There is a newer version: 29
Show newest version
package com.wadpam.open.cache;

import java.util.Map;
import net.sf.jsr107cache.Cache;
import net.sf.jsr107cache.CacheFactory;
import org.springframework.beans.factory.annotation.Autowired;

/**
 *
 * @author os
 */
public class EhCacheFactory implements CacheFactory {
    
    @Autowired
    private net.sf.ehcache.CacheManager ehManager;
    
    @Autowired
    private String cacheName;
    private net.sf.ehcache.Cache cache;
    
    public EhCacheFactory() {
        
    }
    
    public Cache createCache(Map map) {
        if (null == cache) {
            cache = ehManager.getCache(cacheName);
        }
        return new EhCacheWrapper(cache);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy