使用AOP即可。
可参考Jdon框架的Cache实现,或Spring的AOP实现。
public class Test(){
public List getOrganizeList(String id){
String key="organ_list";
if(CacheManager.getCache().get(key)==null){
//读取组织列表
CacheManager.getCache().put(key,organList);
}
return CacheManager.getCache().get(key);
}
}
我现在可以在Caches.xml中配置
这样就可以实现如上代码的效果不?这样业务层应该怎么调用这个getOrganizeList啊?
|
我现在可以在Caches.xml中配置
|
这样就可以实现如上代码的效果不?这样业务层应该怎么调用这个getOrganizeList啊?