public class JedisConnector extends java.lang.Object implements Connector
Modifier and Type | Field and Description |
---|---|
static int |
ACTION_COUNT |
static int |
ACTION_GET |
static int |
ACTION_KEYS |
static int |
ACTION_PARSE |
static int |
ACTION_QUERY |
static int |
ACTION_SET |
static int |
ACTION_SIZE |
static int |
ACTION_TIME |
static int |
ACTION_UPDATE |
protected java.lang.String |
hostname |
protected boolean |
isConnected |
protected java.lang.String |
password |
protected int |
port |
static int |
REDIS_HASH |
static int |
REDIS_LIST |
static int |
REDIS_NONE |
static int |
REDIS_SET |
static int |
REDIS_STRING |
static int |
REDIS_ZSET |
protected redis.clients.jedis.Jedis |
redisClient |
protected int |
timeout |
static java.lang.String[] |
Type |
protected java.lang.String |
uri |
protected java.lang.String |
username |
Constructor and Description |
---|
JedisConnector(java.util.Map props)
Creates new JedisConnector
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
connect() |
int |
count(int type,
java.lang.String key) |
long |
getSize(int id) |
long |
getTTL(java.lang.String key) |
int |
getType(java.lang.String key) |
java.lang.String |
getURI() |
boolean |
isConnected() |
java.lang.String[] |
list(java.lang.String keyPattern) |
static void |
main(java.lang.String[] args) |
static java.lang.String[] |
parse(java.lang.String request)
parses the Redis request and returns args up to 5 of them
|
java.lang.Object |
query(java.lang.String request) |
java.lang.Object |
query(java.lang.String[] args) |
java.lang.String |
reconnect()
It reconnects and returns null or error message upon failure
|
java.lang.String |
redisBlpop(int sec,
java.lang.String key)
removes the first item from the list of key and returns it or null
|
java.lang.String |
redisBrpop(int sec,
java.lang.String key)
removes the last item from the list of key and returns it or null
|
java.lang.String |
redisGet(java.lang.String key) |
long |
redisLpush(java.lang.String key,
java.lang.String str)
prefixes the string to the list of key and returns its position
|
long |
redisPublish(java.lang.String chl,
java.lang.String str)
publishes the string to the channel and returns the number of subs
|
long |
redisRpush(java.lang.String key,
java.lang.String str)
appends the string to the list of key and returns its position
|
java.lang.String |
redisSet(java.lang.String key,
java.lang.String value) |
java.lang.Object |
update(java.lang.String request) |
java.lang.Object |
update(java.lang.String[] args) |
protected java.lang.String hostname
protected java.lang.String uri
protected java.lang.String username
protected java.lang.String password
protected int port
protected int timeout
protected boolean isConnected
public static final int REDIS_NONE
public static final int REDIS_STRING
public static final int REDIS_LIST
public static final int REDIS_HASH
public static final int REDIS_SET
public static final int REDIS_ZSET
public static final int ACTION_GET
public static final int ACTION_SET
public static final int ACTION_KEYS
public static final int ACTION_COUNT
public static final int ACTION_SIZE
public static final int ACTION_TIME
public static final int ACTION_QUERY
public static final int ACTION_UPDATE
public static final int ACTION_PARSE
public static final java.lang.String[] Type
protected redis.clients.jedis.Jedis redisClient
public JedisConnector(java.util.Map props)
protected void connect() throws redis.clients.jedis.exceptions.JedisException
redis.clients.jedis.exceptions.JedisException
public boolean isConnected()
isConnected
in interface Connector
public java.lang.String reconnect()
public long redisPublish(java.lang.String chl, java.lang.String str)
public long redisRpush(java.lang.String key, java.lang.String str)
public long redisLpush(java.lang.String key, java.lang.String str)
public java.lang.String redisBrpop(int sec, java.lang.String key)
public java.lang.String redisBlpop(int sec, java.lang.String key)
public java.lang.String redisGet(java.lang.String key)
public java.lang.String redisSet(java.lang.String key, java.lang.String value)
public java.lang.String[] list(java.lang.String keyPattern)
public int count(int type, java.lang.String key)
public long getTTL(java.lang.String key)
public int getType(java.lang.String key)
public long getSize(int id)
public java.lang.Object update(java.lang.String request)
public java.lang.Object update(java.lang.String[] args)
public java.lang.Object query(java.lang.String request)
public java.lang.Object query(java.lang.String[] args)
public static java.lang.String[] parse(java.lang.String request)
public static void main(java.lang.String[] args)