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

The following examples show how to use redis.clients.jedis.Jedis#sort() . 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: DefaultRedis.java    From craft-atom with MIT License 5 votes vote down vote up
private List<String> sort_offset_count_alpha_desc(Jedis j, String key, int offset, int count, boolean alpha, boolean desc) {
	SortingParams sp = new SortingParams();
	if (desc) {
		sp.desc();
	}
	if (alpha) { 
		sp.alpha() ;
	}
	sp.limit(offset, count);
	
	return j.sort(key, sp);
}
 
Example 2
Source File: DefaultRedis.java    From craft-atom with MIT License 5 votes vote down vote up
private Long sort_offset_count_alpha_desc_destination(Jedis j, String key, int offset, int count, boolean alpha, boolean desc, String destination) {
	SortingParams sp = new SortingParams();
	sp.limit(offset, count);
	if (desc) {
		sp.desc();
	}
	if (alpha) {
		sp.alpha();
	}
	return j.sort(key, sp, destination);
}
 
Example 3
Source File: DefaultRedis.java    From craft-atom with MIT License 5 votes vote down vote up
private Long sort_alpha_desc_destination(Jedis j, String key, boolean alpha, boolean desc, String destination) {
	SortingParams sp = new SortingParams();
	if (desc) {
		sp.desc();
	}
	if (alpha) {
		sp.alpha();
	}
	
	return j.sort(key, sp, destination);
}
 
Example 4
Source File: DefaultRedis.java    From craft-atom with MIT License 5 votes vote down vote up
private Long sort_desc_destination(Jedis j, String key, boolean desc, String destination) {
	SortingParams sp = new SortingParams();
	if (desc) {
		sp.desc();
	}
	return j.sort(key, sp, destination);
}
 
Example 5
Source File: DefaultRedis.java    From craft-atom with MIT License 5 votes vote down vote up
private Long sort_by_desc_destination_get(Jedis j, String key, String bypattern, boolean desc, String destination, String... getpatterns) {
	SortingParams sp = new SortingParams();
	sp.by(bypattern);
	sp.get(getpatterns);
	if (desc) {
		sp.desc();
	}
	
	return j.sort(key, sp, destination);
}
 
Example 6
Source File: DefaultRedis.java    From craft-atom with MIT License 5 votes vote down vote up
private List<String> sort_by_offset_count_alpha_desc_get(Jedis j, String key, String bypattern, int offset, int count, boolean alpha, boolean desc, String... getpatterns) {
	SortingParams sp = new SortingParams();
	sp.by(bypattern);
	sp.get(getpatterns);
	sp.limit(offset, count);
	if (alpha) {
		sp.alpha();
	}
	if (desc) {
		sp.desc();
	}
	
	return j.sort(key, sp);
}
 
Example 7
Source File: DefaultRedis.java    From craft-atom with MIT License 5 votes vote down vote up
private List<String> sort_by_offset_count_get(Jedis j, String key, String bypattern, int offset, int count, String... getpatterns) {
	SortingParams sp = new SortingParams();
	sp.by(bypattern);
	sp.get(getpatterns);
	sp.limit(offset, count);
	return j.sort(key, sp);
}
 
Example 8
Source File: DefaultRedis.java    From craft-atom with MIT License 5 votes vote down vote up
private List<String> sort_by_alpha_desc_get(Jedis j, String key, String bypattern, boolean alpha, boolean desc, String... getpatterns) {
	SortingParams sp = new SortingParams();
	sp.by(bypattern);
	sp.get(getpatterns);
	if (alpha) {
		sp.alpha();
	}
	if (desc) {
		sp.desc();
	}
	
	return j.sort(key, sp);
}
 
Example 9
Source File: DefaultRedis.java    From craft-atom with MIT License 5 votes vote down vote up
private List<String> sort_by_desc_get(Jedis j, String key, String bypattern, boolean desc, String... getpatterns) {
	SortingParams sp = new SortingParams();
	sp.by(bypattern);
	sp.get(getpatterns);
	if (desc) {
		sp.desc();
	}
	
	return j.sort(key, sp);
}
 
Example 10
Source File: DefaultRedis.java    From craft-atom with MIT License 5 votes vote down vote up
private List<String> sort_by_get(Jedis j, String key, String bypattern, String... getpatterns) {
	SortingParams sp = new SortingParams();
	sp.by(bypattern);
	sp.get(getpatterns);
	
	return j.sort(key, sp);
}
 
Example 11
Source File: DefaultRedis.java    From craft-atom with MIT License 5 votes vote down vote up
private Long sort_by_destination_get(Jedis j, String key, String bypattern, String destination, String... getpatterns) {
	SortingParams sp = new SortingParams();
	sp.by(bypattern);
	sp.get(getpatterns);
	
	return j.sort(key, sp, destination);
}
 
Example 12
Source File: DefaultRedis.java    From craft-atom with MIT License 5 votes vote down vote up
private List<String> sort_alpha_desc(Jedis j, String key, boolean alpha, boolean desc) {
	SortingParams sp = new SortingParams();
	if (desc) {
		sp.desc();
	}
	if (alpha) { 
		sp.alpha() ;
	}

	return j.sort(key, sp);
}
 
Example 13
Source File: DefaultRedis.java    From craft-atom with MIT License 5 votes vote down vote up
private List<String> sort_desc(Jedis j, String key, boolean desc) {
	SortingParams sp = new SortingParams();
	if (desc) {
		sp.desc();
	}
	
	return j.sort(key, sp);
}
 
Example 14
Source File: DefaultRedis.java    From craft-atom with MIT License 5 votes vote down vote up
private Long sort_by_alpha_desc_destination_get(Jedis j, String key, String bypattern, boolean alpha, boolean desc, String destination, String... getpatterns) {
	SortingParams sp = new SortingParams();
	sp.by(bypattern);
	sp.get(getpatterns);
	if (alpha) {
		sp.alpha();
	}
	if (desc) {
		sp.desc();
	}
	
	return j.sort(key, sp, destination);
}
 
Example 15
Source File: JedisUtil.java    From BigData with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 对List,Set,SortSet进行排序,如果集合数据较大应避免使用这个方法
 * 
 * @param String
 *            key
 * @return List<String> 集合的全部记录
 * **/
public List<String> sort(String key) {
	// ShardedJedis sjedis = getShardedJedis();
	Jedis sjedis = getJedis();
	List<String> list = sjedis.sort(key);
	returnJedis(sjedis);
	return list;
}
 
Example 16
Source File: JedisUtil.java    From Project with Apache License 2.0 5 votes vote down vote up
/**
 * 对List,Set,SortSet进行排序或limit
 * 
 * @param  key
 * @param  parame 定义排序类型或limit的起止位置.
 * @return List<String> 全部或部分记录
 **/
public List<String> sort(String key, SortingParams parame) {
	// ShardedJedis sjedis = getShardedJedis();
	Jedis sjedis = getJedis();
	List<String> list = sjedis.sort(key, parame);
	sjedis.close();
	return list;
}
 
Example 17
Source File: JedisUtil.java    From Project with Apache License 2.0 5 votes vote down vote up
/**
 * 对List,Set,SortSet进行排序,如果集合数据较大应避免使用这个方法
 * 
 * @param key
 * @return List<String> 集合的全部记录
 **/
public List<String> sort(String key) {
	// ShardedJedis sjedis = getShardedJedis();
	Jedis sjedis = getJedis();
	List<String> list = sjedis.sort(key);
	sjedis.close();
	return list;
}
 
Example 18
Source File: JedisUtils.java    From fw-spring-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * <p>
 * 返回排序后的结果,排序默认以数字作为对象,值被解释为双精度浮点数,然后进行比较。
 * </p>
 *
 * @param key
 * @return 返回列表形式的排序结果
 */
public List<String> sort(String key) {
    Jedis jedis = null;
    try {
        jedis = jedisPool.getResource();
        return jedis.sort(key);
    } catch (Exception e) {

        log.error(e.getMessage());
    } finally {
        returnResource(jedisPool, jedis);
    }
    return null;
}
 
Example 19
Source File: DefaultRedis.java    From craft-atom with MIT License 4 votes vote down vote up
private List<String> sort_offset_count(Jedis j, String key, int offset, int count) {
	return j.sort(key, new SortingParams().limit(offset, count));
}
 
Example 20
Source File: JedisUtil.java    From BigData with GNU General Public License v3.0 3 votes vote down vote up
/**
 * 对List,Set,SortSet进行排序或limit
 * 
 * @param String
 *            key
 * @param SortingParams
 *            parame 定义排序类型或limit的起止位置.
 * @return List<String> 全部或部分记录
 * **/
public List<String> sort(String key, SortingParams parame) {
	// ShardedJedis sjedis = getShardedJedis();
	Jedis sjedis = getJedis();
	List<String> list = sjedis.sort(key, parame);
	returnJedis(sjedis);
	return list;
}