|
@@ -23,6 +23,9 @@ public class RedisCache
|
|
@Autowired
|
|
@Autowired
|
|
public RedisTemplate redisTemplate;
|
|
public RedisTemplate redisTemplate;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private StringRedisTemplate stringRedisTemplate;
|
|
|
|
+
|
|
private volatile static RedisCache instance = null;
|
|
private volatile static RedisCache instance = null;
|
|
|
|
|
|
public static RedisCache getInstance() {
|
|
public static RedisCache getInstance() {
|
|
@@ -35,7 +38,16 @@ public class RedisCache
|
|
}
|
|
}
|
|
return instance;
|
|
return instance;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 缓存基本的对象,Integer、String、实体类等
|
|
|
|
+ *
|
|
|
|
+ * @param key 缓存的键值
|
|
|
|
+ * @param value 缓存的值
|
|
|
|
+ */
|
|
|
|
+ public <T> void setStringObject(final String key, final String value)
|
|
|
|
+ {
|
|
|
|
+ stringRedisTemplate.opsForValue().set(key, value);
|
|
|
|
+ }
|
|
/**
|
|
/**
|
|
* 缓存基本的对象,Integer、String、实体类等
|
|
* 缓存基本的对象,Integer、String、实体类等
|
|
*
|
|
*
|