use of redis.clients.jedis.JedisPool in project tech by ffyyhh995511.
the class JedisService method set.
/*############################################ 字符串(String) 命令 ######################################*/
/**
* 字符串存储
* @param key
* @param value
* @return
*/
public String set(String key, String value) {
String rs = null;
Jedis jedis = null;
JedisPool jedisPool = null;
try {
jedisPool = getJedisPool();
jedis = jedisPool.getResource();
if (jedis != null) {
rs = jedis.set(key, value);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (jedis != null) {
jedis.close();
}
}
return rs;
}
use of redis.clients.jedis.JedisPool in project tech by ffyyhh995511.
the class JedisService method hget.
/**
* 哈希获取
* @param key
* @param field
* @return
*/
public String hget(String key, String field) {
String rs = null;
Jedis jedis = null;
JedisPool jedisPool = null;
try {
jedisPool = getJedisPool();
jedis = jedisPool.getResource();
if (jedis != null) {
rs = jedis.hget(key, field);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (jedis != null) {
jedis.close();
}
}
return rs;
}
use of redis.clients.jedis.JedisPool in project tech by ffyyhh995511.
the class JedisService method get.
public String get(String key) {
String rs = null;
Jedis jedis = null;
JedisPool jedisPool = null;
try {
jedisPool = getJedisPool();
jedis = jedisPool.getResource();
if (jedis != null) {
rs = jedis.get(key);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (jedis != null) {
jedis.close();
}
}
return rs;
}
use of redis.clients.jedis.JedisPool in project tech by ffyyhh995511.
the class JedisService method hdel.
/**
* 哈希删除多个域
* @param key
* @param fields
* @return
*/
public long hdel(String key, String... fields) {
long rs = 0;
Jedis jedis = null;
JedisPool jedisPool = null;
try {
jedisPool = getJedisPool();
jedis = jedisPool.getResource();
if (jedis != null) {
rs = jedis.hdel(key, fields);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (jedis != null) {
jedis.close();
}
}
return rs;
}
use of redis.clients.jedis.JedisPool in project tech by ffyyhh995511.
the class JedisService method zrem.
/**
* 有序列表删除
* @param key
* @param members
* @return
*/
public long zrem(String key, String... members) {
long rs = 0;
Jedis jedis = null;
JedisPool jedisPool = null;
try {
jedisPool = getJedisPool();
jedis = jedisPool.getResource();
if (jedis != null) {
rs = jedis.zrem(key, members);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (jedis != null) {
jedis.close();
}
}
return rs;
}
Aggregations