Commit 4035276a by Future

ehcache

parent d98cc350
......@@ -2,6 +2,7 @@ package com.wecloud.im.service;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
......@@ -27,12 +28,14 @@ public class EhcacheService {
*/
public Boolean getIsPush(String key) {
Cache cache = cacheManager.getCache("push");
Object value = cache.get(key);
log.info("ehcache {}", JSON.toJSONString(value));
if (value != null) {
String value = String.valueOf(cache.get(key));
log.info("ehcache value {}", value);
if (StringUtils.isNotBlank(value)) {
log.info("not blank {}", value);
return false;
} else {
cache.put(key, 1);
log.info("blank");
cache.put(key, "1");
return 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