Search in sources :

Example 1 with PipelineGet

use of com.lcache.extend.handle.pipeline.PipelineGet in project lcache by long172066912.

the class TestRedisCache2 method testPipeline.

@Test
public void testPipeline() {
    BaseCacheExecutor baseCacheExecutor = CacheClientFactory.getCacheExecutor("friend", new LettuceConnectSourceConfig());
    // while (true){
    List<PipelineCmd> commands = new ArrayList<>();
    for (int i = 0; i < 100; i++) {
        commands.add(new PipelineGet("test"));
    }
    commands.add(new PipelineZremRangeByScore("test111", 0, System.currentTimeMillis()));
    // 同步方式
    List<Object> resList = baseCacheExecutor.pSync(commands);
    System.out.println(JSON.toJSONString(resList));
    // 异步方式
    CompletableFuture<List<Object>> listCompletableFuture = baseCacheExecutor.pAsync(commands);
// }
}
Also used : PipelineCmd(com.lcache.extend.handle.pipeline.PipelineCmd) PipelineZremRangeByScore(com.lcache.extend.handle.pipeline.PipelineZremRangeByScore) BaseCacheExecutor(com.lcache.core.BaseCacheExecutor) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) LettuceConnectSourceConfig(com.lcache.extend.handle.redis.lettuce.config.LettuceConnectSourceConfig) PipelineGet(com.lcache.extend.handle.pipeline.PipelineGet) Test(org.junit.Test)

Aggregations

BaseCacheExecutor (com.lcache.core.BaseCacheExecutor)1 PipelineCmd (com.lcache.extend.handle.pipeline.PipelineCmd)1 PipelineGet (com.lcache.extend.handle.pipeline.PipelineGet)1 PipelineZremRangeByScore (com.lcache.extend.handle.pipeline.PipelineZremRangeByScore)1 LettuceConnectSourceConfig (com.lcache.extend.handle.redis.lettuce.config.LettuceConnectSourceConfig)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Test (org.junit.Test)1