Browse Source

[redis][修改]:添加user token缓存

release_toaliyun_real
Stormeye Wu 7 years ago
parent
commit
47f0aa21c9
1 changed files with 18 additions and 0 deletions
  1. +18
    -0
      mallinkMQConsumer/src/main/java/com/iformall/config/RedisConfig.java

+ 18
- 0
mallinkMQConsumer/src/main/java/com/iformall/config/RedisConfig.java View File

@@ -1,6 +1,7 @@
package com.iformall.config; package com.iformall.config;


import com.iformall.domain.po.PushLimit; import com.iformall.domain.po.PushLimit;
import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.WxScoreRules; import com.iformall.domain.po.WxScoreRules;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -108,4 +109,21 @@ public class RedisConfig extends CachingConfigurerSupport {
return template; return template;
} }


@Bean("cuserTokenRedisTemplate")
public RedisTemplate<String, WxCUser> getCUserTokenRedisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, WxCUser> template = new RedisTemplate<String, WxCUser>();

Jackson2JsonRedisSerializer<WxCUser> j = new Jackson2JsonRedisSerializer<WxCUser>(WxCUser.class);
// value值的序列化
template.setValueSerializer(j);
template.setHashKeySerializer(j);

// key的序列化
template.setKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());

template.setConnectionFactory(connectionFactory);
return template;
}

} }

Loading…
Cancel
Save