public class RedisUtil {
/**
* 将obj对象保存到redis
* @param key
* @param obj
*/
public static void save(String key,Object obj){
Jedis jedis = new Jedis("localhost",6379);
//保存
byte[] value = objectToBytes(obj);//序列化
byte[] keys = key.getBytes();
jedis.set(keys, value);
jedis.close();
}
/**
* 将obj对象保存到redis
* @param key
* @param obj
*/
public static void save(String key,Object obj){
Jedis jedis = new Jedis("localhost",6379);
//保存
byte[] value = objectToBytes(obj);//序列化
byte[] keys = key.getBytes();
jedis.set(keys, value);
jedis.close();
}