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

The following examples show how to use redis.clients.jedis.SortingParams#by() . 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 Long sort_by_offset_count_alpha_desc_destination_get(Jedis j, 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();
	}
	
	return j.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_by_offset_count_destination_get(String key, String bypattern, int offset, int count, String destination, String... getpatterns) {
	SortingParams sp = new SortingParams();
	sp.by(bypattern);
	sp.get(getpatterns);
	sp.limit(offset, count);
	
	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_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 4
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 5
Source File: DefaultRedisTransaction.java    From craft-atom with MIT License 5 votes vote down vote up
private void sort_by_destination_get(String key, String bypattern, String destination, String... getpatterns) {
	SortingParams sp = new SortingParams();
	sp.by(bypattern);
	sp.get(getpatterns);
	
	t.sort(key, sp, destination);
}
 
Example 6
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 7
Source File: DefaultRedisTransaction.java    From craft-atom with MIT License 5 votes vote down vote up
private void sort_by_offset_count_get(String key, String bypattern, int offset, int count, String... getpatterns) {
	SortingParams sp = new SortingParams();
	sp.by(bypattern);
	sp.get(getpatterns);
	sp.limit(offset, count);
	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_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 9
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 10
Source File: DefaultRedisTransaction.java    From craft-atom with MIT License 5 votes vote down vote up
private void sort_by_get(String key, String bypattern, String... getpatterns) {
	SortingParams sp = new SortingParams();
	sp.by(bypattern);
	sp.get(getpatterns);
	
	t.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_offset_count_destination_get(Jedis j, String key, String bypattern, int offset, int count, String destination, String... getpatterns) {
	SortingParams sp = new SortingParams();
	sp.by(bypattern);
	sp.get(getpatterns);
	sp.limit(offset, count);
	
	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 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 13
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 14
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 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: 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 17
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 18
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 19
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 20
Source File: SortingCommandsTest.java    From cachecloud with Apache License 2.0 4 votes vote down vote up
@Test
public void sortBy() {
  jedis.lpush("foo", "2");
  jedis.lpush("foo", "3");
  jedis.lpush("foo", "1");

  jedis.set("bar1", "3");
  jedis.set("bar2", "2");
  jedis.set("bar3", "1");

  SortingParams sp = new SortingParams();
  sp.by("bar*");

  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, b2);
  jedis.lpush(bfoo, b3);
  jedis.lpush(bfoo, b1);

  jedis.set(bbar1, b3);
  jedis.set(bbar2, b2);
  jedis.set(bbar3, b1);

  SortingParams bsp = new SortingParams();
  bsp.by(bbarstar);

  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);

}