Authored by caoyan

物权转移

package com.yohoufo.user.constants;
import org.apache.commons.lang3.StringUtils;
import com.yoho.core.config.ConfigReaderUtil;
import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder;
import org.apache.commons.lang3.StringUtils;
/**
* Created by shengguo.cai on 2018/9/18.
... ... @@ -16,7 +17,12 @@ public enum CacheEnum {
/**
* 消息盒子-消息,缓存5分钟
*/
USERS_INBOX_LIST("yh:users:inbox_list", 5 * 60, "users.cachetime.inbox_list"),
// USERS_INBOX_LIST("yh:users:inbox_list", 5 * 60, "users.cachetime.inbox_list"),
/**
* 消息盒子-消息,缓存5分钟
*/
USERS_INBOX_VO_LIST("yh:users:inbox_vo_list", 5 * 60, "users.cachetime.inbox_vo_list"),
/**
* 消息盒子-消息总数,缓存5分钟
... ...
... ... @@ -227,9 +227,9 @@ public class InBoxServiceImpl implements IInBoxService {
}
private void setInboxByRedis(ListInboxReqVO reqVO, List<InBox> inBoxes, int total) {
RedisKeyBuilder inboxKey = CacheEnum.USERS_INBOX_LIST.generateKey(reqVO.getUid());
RedisKeyBuilder inboxKey = CacheEnum.USERS_INBOX_VO_LIST.generateKey(reqVO.getUid());
redisTemplate.put(inboxKey, CacheKeyHelper.getInboxRedisHashKey(reqVO.getType(),reqVO.getPage(),reqVO.getLimit()),
inBoxes,CacheEnum.USERS_INBOX_LIST.getCacheTime());
inBoxes,CacheEnum.USERS_INBOX_VO_LIST.getCacheTime());
RedisKeyBuilder inboxTotalKey = CacheEnum.USERS_INBOX_LIST_TOTAL.generateKey(reqVO.getUid(),reqVO.getType() == null ?"N":reqVO.getType());
redisTemplate.setEx(inboxTotalKey,total,CacheEnum.USERS_INBOX_LIST_TOTAL.getCacheTime());
}
... ... @@ -245,7 +245,7 @@ public class InBoxServiceImpl implements IInBoxService {
private PageResponseVO<InBoxVO> listInboxByRedis(ListInboxReqVO reqVO) {
PageResponseVO<InBoxVO> response = new PageResponseVO<>();
RedisKeyBuilder inboxKey = CacheEnum.USERS_INBOX_LIST.generateKey(reqVO.getUid());
RedisKeyBuilder inboxKey = CacheEnum.USERS_INBOX_VO_LIST.generateKey(reqVO.getUid());
List<InBoxVO> inboxes = redisTemplate.getList(inboxKey, CacheKeyHelper.getInboxRedisHashKey(reqVO.getType(),reqVO.getPage(),reqVO.getLimit()),InBoxVO.class);
RedisKeyBuilder inboxTotalKey = CacheEnum.USERS_INBOX_LIST_TOTAL.generateKey(reqVO.getUid(),reqVO.getType() == null ?"N":reqVO.getType());
Integer total = redisTemplate.get(inboxTotalKey,Integer.class);
... ... @@ -327,7 +327,7 @@ public class InBoxServiceImpl implements IInBoxService {
private void deleteIboxsByRedis(int uid,int type){
log.info("deleteIboxsByRedis params uid is {} type is {}",uid,type);
RedisKeyBuilder inboxKey = CacheEnum.USERS_INBOX_LIST.generateKey(uid);
RedisKeyBuilder inboxKey = CacheEnum.USERS_INBOX_VO_LIST.generateKey(uid);
redisTemplate.delete(inboxKey);
RedisKeyBuilder key = CacheEnum.USERS_INBOX_TYPE_UNREADCOUNT.generateKey(uid,type);
redisTemplate.delete(key);
... ...