Java Code Examples for redis.clients.jedis.Jedis#persist()

The following examples show how to use redis.clients.jedis.Jedis#persist() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JedisUtils.java    From fw-spring-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * <p>
 * 移除给定 key 的生存时间,将这个 key 从『易失的』(带生存时间 key )转换成『持久的』(一个不带生存时间、永不过期的 key )
 * </p>
 *
 * @param key
 * @return 当生存时间移除成功时,返回 1 .如果 key 不存在或 key 没有设置生存时间,返回 0 , 发生异常 返回 -1
 */
public Long persist(String key) {
    Jedis jedis = null;
    try {
        jedis = jedisPool.getResource();
        return jedis.persist(key);
    } catch (Exception e) {

        log.error(e.getMessage());
        return -1L;
    } finally {
        returnResource(jedisPool, jedis);
    }
}
 
Example 2
Source File: JedisUtil.java    From Project with Apache License 2.0 5 votes vote down vote up
/**
 * 取消对key过期时间的设置
 * 
 * @param key
 * @return 影响的记录数
 */
public long persist(String key) {
	Jedis jedis = getJedis();
	long count = jedis.persist(key);
	jedis.close();
	return count;
}
 
Example 3
Source File: JedisUtil.java    From BigData with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 取消对key过期时间的设置
 * 
 * @param key
 * @return 影响的记录数
 * */
public long persist(String key) {
	Jedis jedis = getJedis();
	long count = jedis.persist(key);
	returnJedis(jedis);
	return count;
}
 
Example 4
Source File: DefaultRedis.java    From craft-atom with MIT License 4 votes vote down vote up
private Long persist0(Jedis j, String key) {
	return j.persist(key);
}