admin
2021-04-27 f3ff5ab043cf612e119fd90cd82e49b2cfc2ab5a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.yeshi.buwan.util;
 
import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.config.CacheConfiguration;
 
public class EhcacheUtil {
        
    public static CacheManager cacheManager = CacheManager.getInstance();
    
    public static Cache addCahae(CacheConfiguration cacheConfiguration){
        cacheManager.addCache(new Cache(cacheConfiguration));
        return cacheManager.getCache(cacheConfiguration.getName());
    }
    
    public static void removeCache(String name){
        cacheManager.removeCache(name);
    }
    
    public static Cache getCache(String name){
        return cacheManager.getCache(name);
    }
    
}