admin
2023-04-12 f06a592dd1a7e995bf313ccb5efe7dff73ccfc4e
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);
    }
    
}