2016年

手动ecache处理:importnet.sf.ehcache.Cache;importnet.sf.ehcache.CacheManager;importnet.sf.ehcache.Element;importorg.springframework.cache.annotation.Cacheable;importorg.springframework.cache.ehcache.EhCacheCacheManager;

@Autowired
privateEhCacheCacheManager ehCacheManager;//将查询出来的结果存入cache CacheManager cacheManager =ehCacheManager.getCacheManager();
Cache cache
= cacheManager.getCache("orderCache");
String curCacheKey
=curUserOrganId;
Element el
= null;//查询后验证缓存中是否存入指定key if(cache.isKeyInCache(curCacheKey)){//如果缓存里面有值 el =cache.get(curCacheKey);
count
=(Integer)el.getObjectValue();returncount;
}
//将指定key的缓存对象从缓存中清除 Cache cache = manager.getCache("MY_CACHE");if(cache.isKeyInCache("cache_business_"+business_id)){ //将指定key的缓存对象从缓存中清除 cache.remove("cache_business_"+business_id);
}

 

--在新增或编辑的时候设置默认值或加isnull判断
Sql isnull函数 ISNULL(columName, 0)<>35 或 ISNULL(columName, '')<>'35'
即使是数字类型加上单引号也支持

el表达式截取 逗号后面的字符串
${fn:substringAfter(strVar,',' )}

el表达式判断字段长度
<c:if test="${fn:length(strVar)>65 }">

</c:if>


el表达式截取字符串长度
${fn:substring(strVar,0,16 )}

免责声明
本博客部分内容来自于互联网,不代表作者的观点和立场,如若侵犯到您的权益,请联系[email protected]。我们会在24小时内进行删除。