Search in sources :

Example 31 with ScanParams

use of redis.clients.jedis.ScanParams in project cachecloud by sohutv.

the class SortedSetCommandsTest method zscanMatch.

@Test
public void zscanMatch() {
    ScanParams params = new ScanParams();
    params.match("a*");
    jedis.zadd("foo", 2, "b");
    jedis.zadd("foo", 1, "a");
    jedis.zadd("foo", 11, "aa");
    ScanResult<Tuple> result = jedis.zscan("foo", SCAN_POINTER_START, params);
    assertEquals(SCAN_POINTER_START, result.getCursor());
    assertFalse(result.getResult().isEmpty());
    // binary
    params = new ScanParams();
    params.match(bbarstar);
    jedis.zadd(bfoo, 2, bbar1);
    jedis.zadd(bfoo, 1, bbar2);
    jedis.zadd(bfoo, 11, bbar3);
    ScanResult<Tuple> bResult = jedis.zscan(bfoo, SCAN_POINTER_START_BINARY, params);
    assertArrayEquals(SCAN_POINTER_START_BINARY, bResult.getCursorAsBytes());
    assertFalse(bResult.getResult().isEmpty());
}
Also used : ScanParams(redis.clients.jedis.ScanParams) Tuple(redis.clients.jedis.Tuple) Test(org.junit.Test)

Aggregations

ScanParams (redis.clients.jedis.ScanParams)31 Test (org.junit.Test)27 Tuple (redis.clients.jedis.Tuple)6 DAG (com.datatorrent.api.DAG)2 LocalMode (com.datatorrent.api.LocalMode)2 KeyValPair (org.apache.apex.malhar.lib.util.KeyValPair)2 JSONObject (com.alibaba.fastjson.JSONObject)1 Attribute (com.datatorrent.api.Attribute)1 OperatorContext (com.datatorrent.api.Context.OperatorContext)1 CacheConfigBean (info.xiancloud.core.support.cache.CacheConfigBean)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 OperatorContextTestHelper.mockOperatorContext (org.apache.apex.malhar.lib.helper.OperatorContextTestHelper.mockOperatorContext)1 CollectorTestSink (org.apache.apex.malhar.lib.testbench.CollectorTestSink)1 FieldInfo (org.apache.apex.malhar.lib.util.FieldInfo)1 FSWindowDataManager (org.apache.apex.malhar.lib.wal.FSWindowDataManager)1 SecurityInfo (org.eclipse.leshan.server.security.SecurityInfo)1 Jedis (redis.clients.jedis.Jedis)1