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

com.lindzh.mybatis.generator.ThreadLocalCache Maven / Gradle / Ivy

The newest version!
package com.lindzh.mybatis.generator;

import java.util.HashMap;
import java.util.Map;

/**
 * 
 * @author lindezhi
 * 2015年11月14日 下午5:13:38
 */
public class ThreadLocalCache {
	
	private static ThreadLocal> localCache = new ThreadLocal>();
	
	public static void put(String key,Object value){
		Map cache = localCache.get();
		if(cache==null){
			cache = new HashMap();
			localCache.set(cache);
		}
		cache.put(key, value);
	}
	
	public static Object get(String key){
		Map cache = localCache.get();
		if(cache!=null){
			return cache.get(key);
		}
		return null;
	}
	
	public static void clear(){
		localCache.remove();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy