public class RedisConnector extends java.lang.Object implements Connector
Modifier and Type | Field and Description |
---|---|
static int |
CONNREFUSED |
static int |
CONNTIMEOUT |
protected java.lang.String |
host |
static int |
NOTCONNECTED |
protected java.lang.String |
password |
protected int |
port |
static int |
PROTOCOLERROR |
static int |
READFAILED |
static int |
REDIS_BLPOP |
static int |
REDIS_LPOP |
static int |
REDIS_PUBLISH |
static int |
REDIS_RPUSH |
static int |
REDIS_SUBSCRIBE |
static int |
REDIS_UNSUBSCRIBE |
static int |
REDIS_ZADD |
static int |
REDISERROR |
static int |
REDISTIMEOUT |
static int |
SERVERERROR |
static int |
SOCKERROR |
protected int |
timeout |
protected java.lang.String |
uri |
protected java.lang.String |
username |
static int |
WRITEFAILED |
Constructor and Description |
---|
RedisConnector(java.util.Map props)
Creates new RedisConnector
|
Modifier and Type | Method and Description |
---|---|
long |
blpop(java.lang.String key,
int sec,
java.io.OutputStream bos) |
void |
close() |
protected void |
connect() |
java.lang.String |
getURI() |
boolean |
isConnected() |
long |
lpop(java.lang.String key,
java.io.OutputStream bos) |
static void |
main(java.lang.String[] args) |
java.lang.String |
nextMessage(int sec,
java.io.OutputStream bos) |
long |
publish(java.lang.String key,
java.lang.String data) |
java.lang.String |
reconnect()
It reconnects and returns null or error message upon failure
|
static byte[] |
redisCommand(int id,
java.lang.String key,
java.lang.String data) |
static byte[] |
redisCommand(int id,
java.lang.String key,
java.lang.String data,
double d) |
static byte[] |
redisCommand(int id,
java.lang.String key,
java.lang.String data,
int n) |
long |
rpush(java.lang.String key,
java.lang.String data) |
int |
subscribe(java.lang.String key) |
int |
unsubscribe(java.lang.String key) |
protected java.lang.String username
protected java.lang.String password
protected java.lang.String uri
protected java.lang.String host
protected int port
protected int timeout
public static final int REDISTIMEOUT
public static final int PROTOCOLERROR
public static final int NOTCONNECTED
public static final int REDISERROR
public static final int SOCKERROR
public static final int SERVERERROR
public static final int READFAILED
public static final int WRITEFAILED
public static final int CONNTIMEOUT
public static final int CONNREFUSED
public static final int REDIS_RPUSH
public static final int REDIS_PUBLISH
public static final int REDIS_ZADD
public static final int REDIS_LPOP
public static final int REDIS_BLPOP
public static final int REDIS_SUBSCRIBE
public static final int REDIS_UNSUBSCRIBE
public RedisConnector(java.util.Map props)
public long lpop(java.lang.String key, java.io.OutputStream bos)
public long blpop(java.lang.String key, int sec, java.io.OutputStream bos)
public long rpush(java.lang.String key, java.lang.String data)
public long publish(java.lang.String key, java.lang.String data)
public int subscribe(java.lang.String key)
public int unsubscribe(java.lang.String key)
public java.lang.String nextMessage(int sec, java.io.OutputStream bos) throws java.io.IOException
java.io.IOException
public static byte[] redisCommand(int id, java.lang.String key, java.lang.String data, int n)
public static byte[] redisCommand(int id, java.lang.String key, java.lang.String data, double d)
public static byte[] redisCommand(int id, java.lang.String key, java.lang.String data)
public boolean isConnected()
isConnected
in interface Connector
public java.lang.String reconnect()
protected void connect() throws java.io.IOException
java.io.IOException
public static void main(java.lang.String[] args)