本文整理汇总了Java中redis.clients.jedis.Protocol.Command类的典型用法代码示例。如果您正苦于以下问题:Java Command类的具体用法?Java Command怎么用?Java Command使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Command类属于redis.clients.jedis.Protocol包,在下文中一共展示了Command类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getErrorAfterConnectionReset
import redis.clients.jedis.Protocol.Command; //导入依赖的package包/类
@Test
public void getErrorAfterConnectionReset() throws Exception {
class TestConnection extends Connection {
public TestConnection() {
super("localhost", 6379);
}
@Override
protected Connection sendCommand(ProtocolCommand cmd, byte[]... args) {
return super.sendCommand(cmd, args);
}
}
TestConnection conn = new TestConnection();
try {
conn.sendCommand(Command.HMSET, new byte[1024 * 1024 + 1][0]);
fail("Should throw exception");
} catch (JedisConnectionException jce) {
assertEquals("ERR Protocol error: invalid multibulk length", jce.getMessage());
}
}
开发者ID:sohutv,项目名称:cachecloud,代码行数:23,代码来源:ConnectionTest.java
示例2: getErrorAfterConnectionReset
import redis.clients.jedis.Protocol.Command; //导入依赖的package包/类
@Test
public void getErrorAfterConnectionReset() throws Exception {
class TestConnection extends Connection {
public TestConnection() {
super("localhost", 6379);
}
protected boolean sendCommand(Command cmd, byte[]... args) {
return super.sendCommand(cmd, args);
}
}
TestConnection conn = new TestConnection();
try {
conn.sendCommand(Command.HMSET, new byte[1024 * 1024 + 1][0]);
fail("Should throw exception");
} catch (JedisConnectionException jce) {
assertEquals("ERR Protocol error: invalid multibulk length", jce.getMessage());
}
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:22,代码来源:ConnectionTest.java
示例3: process
import redis.clients.jedis.Protocol.Command; //导入依赖的package包/类
@Around("execution(* redis.clients.jedis.Protocol.*sendCommand(..))")
public Object process(ProceedingJoinPoint point) throws Throwable {
System.out.println("@Around:执行目标方法之前...");
//访问目标方法的参数:
Object[] args = point.getArgs();
//进行业务验证
long begin = System.nanoTime();
if(null!=args && null!=args[1] && args[1] instanceof Command){
logger.info("command:"+((Command)args[1]).name()+","+CacheUtils.getSendCommondSizeType(args));
}else if (null!=args && null!=args[1] && args[1] instanceof byte[]){
logger.info("command:"+new String((byte[])args[1])+","+CacheUtils.getSendCommondSizeType(args));
}else{
logger.info(CacheUtils.getSendCommondSizeType(args));
}
Object returnValue = point.proceed(args);
long time = System.nanoTime() - begin;
logger.info(point.getSignature()+",last "+time/1000000+"ms");
System.out.println("@Around:执行目标方法之后...");
return returnValue;
}
开发者ID:ningyu1,项目名称:jodis-client,代码行数:21,代码来源:RedisCmdFilter.java
示例4: sendCommand
import redis.clients.jedis.Protocol.Command; //导入依赖的package包/类
protected Connection sendCommand(final Command cmd, final String... args) {
final byte[][] bargs = new byte[args.length][];
for (int i = 0; i < args.length; i++) {
bargs[i] = SafeEncoder.encode(args[i]);
}
return sendCommand(cmd, bargs);
}
开发者ID:x7-framework,项目名称:x7,代码行数:8,代码来源:Connection.java
示例5: doSendCommandStart
import redis.clients.jedis.Protocol.Command; //导入依赖的package包/类
@SuppressWarnings({ "unchecked" })
public Object doSendCommandStart(Object[] args) {
Command cmd = (Command) args[0];
String host = (String) args[2];
Integer port = (Integer) args[3];
String targetURL = "redis://" + host + ":" + port;
String redisAction = cmd.name();
if (logger.isDebugable()) {
logger.debug("REDIS INVOKE START: " + targetURL + " action: " + redisAction, null);
}
Map<String, Object> params = new HashMap<String, Object>();
params.put(CaptureConstants.INFO_CLIENT_REQUEST_URL, targetURL);
params.put(CaptureConstants.INFO_CLIENT_REQUEST_ACTION, redisAction);
params.put(CaptureConstants.INFO_CLIENT_APPID, appid);
params.put(CaptureConstants.INFO_CLIENT_TYPE, "redis.client.Jedis");
UAVServer.instance().runMonitorCaptureOnServerCapPoint(CaptureConstants.CAPPOINT_APP_CLIENT,
Monitor.CapturePhase.PRECAP, params);
// register adapter
UAVServer.instance().runSupporter("com.creditease.uav.apm.supporters.InvokeChainSupporter", "registerAdapter",
JedisClientAdapter.class);
ivcContextParams = (Map<String, Object>) UAVServer.instance().runSupporter(
"com.creditease.uav.apm.supporters.InvokeChainSupporter", "runCap",
InvokeChainConstants.CHAIN_APP_CLIENT, InvokeChainConstants.CapturePhase.PRECAP, params,
JedisClientAdapter.class, args);
return null;
}
开发者ID:uavorg,项目名称:uavstack,代码行数:34,代码来源:JedisConnectionIT.java
示例6: eval
import redis.clients.jedis.Protocol.Command; //导入依赖的package包/类
@Override
public Object eval(String script, String key) {
Span span = helper.buildSpan(Command.EVAL.name(), key);
span.setTag("script", script);
try {
return super.eval(script, key);
} catch (Exception e) {
onError(e, span);
throw e;
} finally {
span.finish();
}
}
开发者ID:opentracing-contrib,项目名称:java-redis-client,代码行数:14,代码来源:TracingJedisCluster.java
示例7: evalsha
import redis.clients.jedis.Protocol.Command; //导入依赖的package包/类
@Override
public Object evalsha(String script, String key) {
Span span = helper.buildSpan(Command.EVALSHA.name(), key);
span.setTag("script", script);
try {
return super.evalsha(script, key);
} catch (Exception e) {
onError(e, span);
throw e;
} finally {
span.finish();
}
}
开发者ID:opentracing-contrib,项目名称:java-redis-client,代码行数:14,代码来源:TracingJedisCluster.java
示例8: sendCommand
import redis.clients.jedis.Protocol.Command; //导入依赖的package包/类
protected Connection sendCommand(final Command cmd, final String... args) {
final byte[][] bargs = new byte[args.length][];
for (int i = 0; i < args.length; i++) {
bargs[i] = SafeEncoder.encode(args[i]);
}
return sendCommand(cmd, bargs);
}
开发者ID:wjw465150,项目名称:shiro-redis,代码行数:8,代码来源:Connection.java
示例9: infoAll
import redis.clients.jedis.Protocol.Command; //导入依赖的package包/类
/**
* Sends the "INFO all" command.
*/
public Properties infoAll() {
sendCommand(Command.INFO, "all");
String reply = getBulkReply();
Properties p = new Properties();
try {
p.load(new StringReader(reply));
} catch (IOException e) {
throw new JedisDataException(e);
}
return p;
}
开发者ID:genman,项目名称:rhq-plugins,代码行数:15,代码来源:Client2.java
示例10: ping
import redis.clients.jedis.Protocol.Command; //导入依赖的package包/类
public void ping() {
sendCommand(Command.PING);
}
开发者ID:x7-framework,项目名称:x7,代码行数:4,代码来源:BinaryClient.java
示例11: set
import redis.clients.jedis.Protocol.Command; //导入依赖的package包/类
public void set(final byte[] key, final byte[] value) {
sendCommand(Command.SET, key, value);
}
开发者ID:x7-framework,项目名称:x7,代码行数:4,代码来源:BinaryClient.java
示例12: get
import redis.clients.jedis.Protocol.Command; //导入依赖的package包/类
public void get(final byte[] key) {
sendCommand(Command.GET, key);
}
开发者ID:x7-framework,项目名称:x7,代码行数:4,代码来源:BinaryClient.java
示例13: asking
import redis.clients.jedis.Protocol.Command; //导入依赖的package包/类
public void asking() {
sendCommand(Command.ASKING);
}
开发者ID:x7-framework,项目名称:x7,代码行数:4,代码来源:BinaryClient.java
示例14: set
import redis.clients.jedis.Protocol.Command; //导入依赖的package包/类
public void set(final byte[] key, final byte[] value) {
sendCommand(Command.SET, key, value);
}
开发者ID:wjw465150,项目名称:shiro-redis,代码行数:4,代码来源:BinaryClient.java
示例15: get
import redis.clients.jedis.Protocol.Command; //导入依赖的package包/类
public void get(final byte[] key) {
sendCommand(Command.GET, key);
}
开发者ID:wjw465150,项目名称:shiro-redis,代码行数:4,代码来源:BinaryClient.java
示例16: sendCommand
import redis.clients.jedis.Protocol.Command; //导入依赖的package包/类
protected Connection sendCommand(Command cmd) {
return this.sendCommand(cmd, EMPTY_ARGS);
}
开发者ID:EdwardLee03,项目名称:jedis-sr,代码行数:4,代码来源:Connection.java
示例17: ping
import redis.clients.jedis.Protocol.Command; //导入依赖的package包/类
public void ping() {
sendCommand(Command.PING);
}
开发者ID:EdwardLee03,项目名称:jedis-sr,代码行数:4,代码来源:BinaryClient.java
示例18: set
import redis.clients.jedis.Protocol.Command; //导入依赖的package包/类
public void set(final byte[] key, final byte[] value) {
sendCommand(Command.SET, key, value);
}
开发者ID:EdwardLee03,项目名称:jedis-sr,代码行数:4,代码来源:BinaryClient.java
示例19: get
import redis.clients.jedis.Protocol.Command; //导入依赖的package包/类
public void get(final byte[] key) {
sendCommand(Command.GET, key);
}
开发者ID:EdwardLee03,项目名称:jedis-sr,代码行数:4,代码来源:BinaryClient.java
示例20: asking
import redis.clients.jedis.Protocol.Command; //导入依赖的package包/类
public void asking() {
sendCommand(Command.ASKING);
}
开发者ID:EdwardLee03,项目名称:jedis-sr,代码行数:4,代码来源:BinaryClient.java
注:本文中的redis.clients.jedis.Protocol.Command类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论