Commit 1d87feb8 authored by yanzg's avatar yanzg

修改实例化关系

parent 820d4d73
......@@ -2,8 +2,7 @@ package com.yanzuoguang.util.cache;
import com.yanzuoguang.util.helper.StringHelper;
import java.util.Date;
import java.util.Map;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
/**
......@@ -216,6 +215,19 @@ public class MemoryCache<T> {
MemoryCacheCenter.CLEAR_LIST.remove(this);
}
/**
* 获取所有的关键字
*
* @return
*/
public synchronized Collection<T> getValues() {
List<T> list = new ArrayList<>();
for(MemoryCacheItem<T> item:cache.values()){
list.add(item.getData());
}
return list;
}
/**
* 获取所有的关键字
*
......
......@@ -24,4 +24,14 @@ public class TestDbPrintSql {
SqlData sqlData = cache.getNameCache().get(DaoConst.GROUP_ADD);
System.out.println(JsonHelper.serialize(sqlData, true));
}
@Test
public void testTable() {
TableSqlCache cache = new TableSqlCache();
TableStruct table = new TableStruct("test", TestTableGroupVo.class);
table.init(cache);
System.out.println(JsonHelper.serialize(cache.getNameCache(), true));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment