forked from fanruan/demo-tabledata-redis
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.1 KiB
34 lines
1.1 KiB
package com.fr.plugin.db.redis.core.visit.impl; |
|
|
|
import com.fanruan.api.util.ArrayKit; |
|
import com.fr.plugin.db.redis.core.visit.AbstractVisitor; |
|
import com.fr.stable.ParameterProvider; |
|
import com.fr.stable.script.CalculatorProvider; |
|
import redis.clients.jedis.Jedis; |
|
|
|
import java.util.ArrayList; |
|
import java.util.List; |
|
|
|
/** |
|
* Created by richie on 2017/5/3. |
|
*/ |
|
public class MGetVisitor extends AbstractVisitor<String> { |
|
@Override |
|
public List<List<String>> getContent(CalculatorProvider calculator, ParameterProvider[] ps, Jedis client, String query, int rowCount) throws Exception { |
|
String[] arr = query.trim().split(TOKEN_SPACE); |
|
if (arr.length < 2) { |
|
throw new IllegalArgumentException("Illegal query:" + query); |
|
} |
|
String[] args = (String[]) ArrayKit.remove(arr, 0); |
|
List<String> data = client.mget(args); |
|
List<List<String>> result = new ArrayList<List<String>>(); |
|
result.add(data); |
|
result.add(data); |
|
return result; |
|
} |
|
|
|
@Override |
|
public String keyWord() { |
|
return "mget"; |
|
} |
|
}
|
|
|