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.
|
|
|
package com.fr.plugin.db.redis.core.visit.impl;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
public class GetVisitor 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 data = client.get(trimCommand(arr[1]));
|
|
|
|
List<String> column = new ArrayList<String>();
|
|
|
|
column.add(data);
|
|
|
|
|
|
|
|
List<List<String>> result = new ArrayList<List<String>>();
|
|
|
|
result.add(column);
|
|
|
|
result.add(column);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String keyWord() {
|
|
|
|
return "get";
|
|
|
|
}
|
|
|
|
}
|