Authored by DengXinFei

redis配置

@@ -3,6 +3,9 @@ package com.yoho.unions.common.redis; @@ -3,6 +3,9 @@ package com.yoho.unions.common.redis;
3 import org.slf4j.Logger; 3 import org.slf4j.Logger;
4 import org.slf4j.LoggerFactory; 4 import org.slf4j.LoggerFactory;
5 import org.springframework.data.redis.connection.RedisConnection; 5 import org.springframework.data.redis.connection.RedisConnection;
  6 +import org.springframework.data.redis.core.RedisCallback;
  7 +import org.springframework.data.redis.core.RedisTemplate;
  8 +import org.springframework.data.redis.core.TimeoutUtils;
6 9
7 import java.io.UnsupportedEncodingException; 10 import java.io.UnsupportedEncodingException;
8 import java.util.concurrent.TimeUnit; 11 import java.util.concurrent.TimeUnit;
@@ -12,7 +15,7 @@ import java.util.concurrent.TimeUnit; @@ -12,7 +15,7 @@ import java.util.concurrent.TimeUnit;
12 * 重写RedisTemplate,支持读写分离,支持long expire 15 * 重写RedisTemplate,支持读写分离,支持long expire
13 * 16 *
14 */ 17 */
15 -public class YHRedisTemplate<K,V> extends RedisTemplate<K, V> { 18 +public class YHRedisTemplate<K,V> extends RedisTemplate<K, V> {
16 19
17 private final Logger logger = LoggerFactory.getLogger(this.getClass()); 20 private final Logger logger = LoggerFactory.getLogger(this.getClass());
18 21
@@ -55,7 +55,14 @@ @@ -55,7 +55,14 @@
55 <groupId>com.netflix.archaius</groupId> 55 <groupId>com.netflix.archaius</groupId>
56 <artifactId>archaius-zookeeper</artifactId> 56 <artifactId>archaius-zookeeper</artifactId>
57 </dependency> 57 </dependency>
58 - 58 + <dependency>
  59 + <groupId>redis.clients</groupId>
  60 + <artifactId>jedis</artifactId>
  61 + </dependency>
  62 + <dependency>
  63 + <groupId>org.springframework.data</groupId>
  64 + <artifactId>spring-data-redis</artifactId>
  65 + </dependency>
59 <dependency> 66 <dependency>
60 <groupId>commons-io</groupId> 67 <groupId>commons-io</groupId>
61 <artifactId>commons-io</artifactId> 68 <artifactId>commons-io</artifactId>
@@ -8,6 +8,8 @@ import java.util.concurrent.TimeUnit; @@ -8,6 +8,8 @@ import java.util.concurrent.TimeUnit;
8 8
9 import javax.annotation.Resource; 9 import javax.annotation.Resource;
10 10
  11 +import com.yoho.unions.common.redis.YHRedisTemplate;
  12 +import com.yoho.unions.common.redis.YHValueOperations;
11 import org.apache.commons.lang.StringUtils; 13 import org.apache.commons.lang.StringUtils;
12 import org.slf4j.Logger; 14 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory; 15 import org.slf4j.LoggerFactory;
@@ -16,8 +18,6 @@ import org.springframework.stereotype.Service; @@ -16,8 +18,6 @@ import org.springframework.stereotype.Service;
16 import com.alibaba.fastjson.JSON; 18 import com.alibaba.fastjson.JSON;
17 import com.alibaba.fastjson.JSONObject; 19 import com.alibaba.fastjson.JSONObject;
18 import com.yoho.activity.service.DrawService; 20 import com.yoho.activity.service.DrawService;
19 -import com.yoho.core.redis.YHRedisTemplate;  
20 -import com.yoho.core.redis.YHValueOperations;  
21 import com.yoho.error.ServiceError; 21 import com.yoho.error.ServiceError;
22 import com.yoho.error.exception.ServiceException; 22 import com.yoho.error.exception.ServiceException;
23 import com.yoho.service.model.union.request.DrawRequestBO; 23 import com.yoho.service.model.union.request.DrawRequestBO;