Java Code Examples for redis.clients.jedis.SortingParams#desc()

The following examples show how to use redis.clients.jedis.SortingParams#desc() . 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: DefaultRedisTransaction.java    From craft-atom with MIT License 5 votes vote down vote up
private void sort_alpha_desc_destination(String key, boolean alpha, boolean desc, String destination) {
	SortingParams sp = new SortingParams();
	if (desc) {
		sp.desc();
	}
	if (alpha) {
		sp.alpha();
	}
	
	t.sort(key, sp, destination);
}
 
Example 2
Source File: DefaultRedisTransaction.java    From craft-atom with MIT License 5 votes vote down vote up
private void sort_desc_destination(String key, boolean desc, String destination) {
	SortingParams sp = new SortingParams();
	if (desc) {
		sp.desc();
	}
	t.sort(key, sp, destination);
}
 
Example 3
Source File: DefaultRedisTransaction.java    From craft-atom with MIT License 5 votes vote down vote up
private void sort_by_offset_count_alpha_desc_get(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();
	}
	
	t.sort(key, sp);
}
 
Example 4
Source File: DefaultRedisTransaction.java    From craft-atom with MIT License 5 votes vote down vote up
private void sort_by_alpha_desc_get(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();
	}
	
	t.sort(key, sp);
}
 
Example 5
Source File: DefaultRedisTransaction.java    From craft-atom with MIT License 5 votes vote down vote up
private void sort_by_desc_get(String key, String bypattern, boolean desc, String... getpatterns) {
	SortingParams sp = new SortingParams();
	sp.by(bypattern);
	sp.get(getpatterns);
	if (desc) {
		sp.desc();
	}
	
	t.sort(key, sp);
}
 
Example 6
Source File: DefaultRedisTransaction.java    From craft-atom with MIT License 5 votes vote down vote up
private void sort_offset_count_alpha_desc(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);
	
	t.sort(key, sp);
}
 
Example 7
Source File: DefaultRedisTransaction.java    From craft-atom with MIT License 5 votes vote down vote up
private void sort_alpha_desc(String key, boolean alpha, boolean desc) {
	SortingParams sp = new SortingParams();
	if (desc) {
		sp.desc();
	}
	if (alpha) { 
		sp.alpha() ;
	}

	t.sort(key, sp);
}
 
Example 8
Source File: DefaultRedisTransaction.java    From craft-atom with MIT License 5 votes vote down vote up
private void sort_offset_count_alpha_desc_destination(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();
	}
	t.sort(key, sp, destination);
}
 
Example 9
Source File: DefaultRedisTransaction.java    From craft-atom with MIT License 5 votes vote down vote up
private void sort_by_alpha_desc_destination_get(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();
	}
	
	t.sort(key, sp, destination);
}
 
Example 10
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 11
Source File: SortingCommandsTest.java    From cachecloud with Apache License 2.0 5 votes vote down vote up
@Test
public void sortDesc() {
  jedis.lpush("foo", "3");
  jedis.lpush("foo", "2");
  jedis.lpush("foo", "1");

  SortingParams sp = new SortingParams();
  sp.desc();

  List<String> result = jedis.sort("foo", sp);

  List<String> expected = new ArrayList<String>();
  expected.add("3");
  expected.add("2");
  expected.add("1");

  assertEquals(expected, result);

  // Binary
  jedis.lpush(bfoo, b3);
  jedis.lpush(bfoo, b2);
  jedis.lpush(bfoo, b1);

  SortingParams bsp = new SortingParams();
  bsp.desc();

  List<byte[]> bresult = jedis.sort(bfoo, bsp);

  List<byte[]> bexpected = new ArrayList<byte[]>();
  bexpected.add(b3);
  bexpected.add(b2);
  bexpected.add(b1);

  assertEquals(bexpected, bresult);
}
 
Example 12
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 13
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 14
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 15
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 16
Source File: DefaultRedisTransaction.java    From craft-atom with MIT License 5 votes vote down vote up
private void sort_by_desc_destination_get(String key, String bypattern, boolean desc, String destination, String... getpatterns) {
	SortingParams sp = new SortingParams();
	sp.by(bypattern);
	sp.get(getpatterns);
	if (desc) {
		sp.desc();
	}
	
	t.sort(key, sp, destination);
}
 
Example 17
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 18
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 19
Source File: DefaultRedisTransaction.java    From craft-atom with MIT License 5 votes vote down vote up
private void sort_by_offset_count_alpha_desc_destination_get(String key, String bypattern, int offset, int count, boolean alpha, boolean desc, String destination, String... getpatterns) {
	SortingParams sp = new SortingParams();
	sp.by(bypattern);
	sp.get(getpatterns);
	sp.limit(offset, count);
	if (alpha) {
		sp.alpha();
	}
	if (desc) {
		sp.desc();
	}
	
	t.sort(key, sp, destination);
}
 
Example 20
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);
}