本文整理汇总了Java中redis.clients.jedis.SortingParams.limit方法的典型用法代码示例。如果您正苦于以下问题:Java SortingParams.limit方法的具体用法?Java SortingParams.limit怎么用?Java SortingParams.limit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类redis.clients.jedis.SortingParams
的用法示例。
在下文中一共展示了SortingParams.limit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sortLimit
import redis.clients.jedis.SortingParams; //导入方法依赖的package包/类
@Test
public void sortLimit() {
for (int n = 10; n > 0; n--) {
jedis.lpush("foo", String.valueOf(n));
}
SortingParams sp = new SortingParams();
sp.limit(0, 3);
List<String> result = jedis.sort("foo", sp);
List<String> expected = new ArrayList<String>();
expected.add("1");
expected.add("2");
expected.add("3");
assertEquals(expected, result);
// Binary
jedis.rpush(bfoo, new byte[] { (byte) '4' });
jedis.rpush(bfoo, new byte[] { (byte) '3' });
jedis.rpush(bfoo, new byte[] { (byte) '2' });
jedis.rpush(bfoo, new byte[] { (byte) '1' });
SortingParams bsp = new SortingParams();
bsp.limit(0, 3);
List<byte[]> bresult = jedis.sort(bfoo, bsp);
List<byte[]> bexpected = new ArrayList<byte[]>();
bexpected.add(b1);
bexpected.add(b2);
bexpected.add(b3);
assertByteArrayListEquals(bexpected, bresult);
}
示例2: sortLimit
import redis.clients.jedis.SortingParams; //导入方法依赖的package包/类
@Test
public void sortLimit() {
for (int n = 10; n > 0; n--) {
jedis.lpush("foo", String.valueOf(n));
}
SortingParams sp = new SortingParams();
sp.limit(0, 3);
List<String> result = jedis.sort("foo", sp);
List<String> expected = new ArrayList<String>();
expected.add("1");
expected.add("2");
expected.add("3");
assertEquals(expected, result);
// Binary
jedis.rpush(bfoo, new byte[] { (byte) '4' });
jedis.rpush(bfoo, new byte[] { (byte) '3' });
jedis.rpush(bfoo, new byte[] { (byte) '2' });
jedis.rpush(bfoo, new byte[] { (byte) '1' });
SortingParams bsp = new SortingParams();
bsp.limit(0, 3);
List<byte[]> bresult = jedis.sort(bfoo, bsp);
List<byte[]> bexpected = new ArrayList<byte[]>();
bexpected.add(b1);
bexpected.add(b2);
bexpected.add(b3);
assertEquals(bexpected, bresult);
}
示例3: sort_offset_count_alpha_desc
import redis.clients.jedis.SortingParams; //导入方法依赖的package包/类
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);
}
示例4: sort_by_offset_count_get
import redis.clients.jedis.SortingParams; //导入方法依赖的package包/类
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);
}
示例5: sort_by_offset_count_alpha_desc_get
import redis.clients.jedis.SortingParams; //导入方法依赖的package包/类
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);
}
示例6: sort_offset_count_alpha_desc_destination
import redis.clients.jedis.SortingParams; //导入方法依赖的package包/类
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);
}
示例7: sort_by_offset_count_destination_get
import redis.clients.jedis.SortingParams; //导入方法依赖的package包/类
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);
}
示例8: sort_by_offset_count_alpha_desc_destination_get
import redis.clients.jedis.SortingParams; //导入方法依赖的package包/类
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);
}
示例9: sort_offset_count_alpha_desc
import redis.clients.jedis.SortingParams; //导入方法依赖的package包/类
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);
}
示例10: sort_by_offset_count_get
import redis.clients.jedis.SortingParams; //导入方法依赖的package包/类
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);
}
示例11: sort_by_offset_count_alpha_desc_get
import redis.clients.jedis.SortingParams; //导入方法依赖的package包/类
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);
}
示例12: sort_offset_count_alpha_desc_destination
import redis.clients.jedis.SortingParams; //导入方法依赖的package包/类
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);
}
示例13: sort_by_offset_count_destination_get
import redis.clients.jedis.SortingParams; //导入方法依赖的package包/类
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);
}
示例14: sort_by_offset_count_alpha_desc_destination_get
import redis.clients.jedis.SortingParams; //导入方法依赖的package包/类
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);
}
示例15: sort_offset_count_destination
import redis.clients.jedis.SortingParams; //导入方法依赖的package包/类
private Long sort_offset_count_destination(Jedis j, String key, int offset, int count, String destination) {
SortingParams sp = new SortingParams();
sp.limit(offset, count);
return j.sort(key, sp, destination);
}