use of redis.clients.util.RedisInputStream in project cachecloud by sohutv.
the class ProtocolBenchmark method measureInputMulti.
private static long measureInputMulti() throws Exception {
long duration = 0;
InputStream is = new ByteArrayInputStream("*4\r\n$3\r\nfoo\r\n$13\r\nbarbarbarfooz\r\n$5\r\nHello\r\n$5\r\nWorld\r\n".getBytes());
RedisInputStream in = new RedisInputStream(is);
for (int n = 0; n <= TOTAL_OPERATIONS; n++) {
long start = System.nanoTime();
Protocol.read(in);
duration += (System.nanoTime() - start);
in.reset();
}
return duration;
}
use of redis.clients.util.RedisInputStream in project cachecloud by sohutv.
the class ProtocolTest method bulkReply.
@Test
public void bulkReply() {
InputStream is = new ByteArrayInputStream("$6\r\nfoobar\r\n".getBytes());
byte[] response = (byte[]) Protocol.read(new RedisInputStream(is));
assertArrayEquals(SafeEncoder.encode("foobar"), response);
}
use of redis.clients.util.RedisInputStream in project cachecloud by sohutv.
the class ProtocolTest method nullMultiBulkReply.
@SuppressWarnings("unchecked")
@Test
public void nullMultiBulkReply() {
InputStream is = new ByteArrayInputStream("*-1\r\n".getBytes());
List<String> response = (List<String>) Protocol.read(new RedisInputStream(is));
assertNull(response);
}
use of redis.clients.util.RedisInputStream in project cachecloud by sohutv.
the class ProtocolTest method singleLineReply.
@Test
public void singleLineReply() {
InputStream is = new ByteArrayInputStream("+OK\r\n".getBytes());
byte[] response = (byte[]) Protocol.read(new RedisInputStream(is));
assertArrayEquals(SafeEncoder.encode("OK"), response);
}
use of redis.clients.util.RedisInputStream in project jedis by xetorthio.
the class ProtocolBenchmark method measureInputMulti.
private static long measureInputMulti() throws Exception {
long duration = 0;
InputStream is = new ByteArrayInputStream("*4\r\n$3\r\nfoo\r\n$13\r\nbarbarbarfooz\r\n$5\r\nHello\r\n$5\r\nWorld\r\n".getBytes());
RedisInputStream in = new RedisInputStream(is);
for (int n = 0; n <= TOTAL_OPERATIONS; n++) {
long start = System.nanoTime();
Protocol.read(in);
duration += (System.nanoTime() - start);
in.reset();
}
return duration;
}
Aggregations