public class RedisConnection<K,V> extends Object
RedisConnection
provided they avoid blocking and transactional
operations such as blpop(long, K...)
and multi()
/exec()
.
A ConnectionWatchdog
monitors each connection and reconnects
automatically until close()
is called. All pending commands will be
(re)sent after successful reconnection.Modifier and Type | Field and Description |
---|---|
protected RedisAsyncConnection<K,V> |
c |
protected long |
timeout |
protected TimeUnit |
unit |
Constructor and Description |
---|
RedisConnection(RedisAsyncConnection<K,V> c)
Initialize a new connection.
|
Modifier and Type | Method and Description |
---|---|
Long |
append(K key,
V value) |
String |
auth(String password) |
String |
bgrewriteaof() |
String |
bgsave() |
Long |
bitcount(K key) |
Long |
bitcount(K key,
long start,
long end) |
Long |
bitopAnd(K destination,
K... keys) |
Long |
bitopNot(K destination,
K source) |
Long |
bitopOr(K destination,
K... keys) |
Long |
bitopXor(K destination,
K... keys) |
KeyValue<K,V> |
blpop(long timeout,
K... keys) |
KeyValue<K,V> |
brpop(long timeout,
K... keys) |
V |
brpoplpush(long timeout,
K source,
K destination) |
K |
clientGetname() |
String |
clientKill(String addr) |
String |
clientList() |
String |
clientSetname(K name) |
void |
close()
Close the connection.
|
List<String> |
configGet(String parameter) |
String |
configResetstat() |
String |
configSet(String parameter,
String value) |
Long |
dbsize() |
String |
debugObject(K key) |
Long |
decr(K key) |
Long |
decrby(K key,
long amount) |
Long |
del(K... keys) |
String |
digest(V script)
Generate SHA-1 digest for the supplied script.
|
String |
discard() |
byte[] |
dump(K key) |
V |
echo(V msg) |
<T> T |
eval(V script,
ScriptOutputType type,
K... keys)
Eval the supplied script, which must result in the requested
type . |
<T> T |
eval(V script,
ScriptOutputType type,
K[] keys,
V... values) |
<T> T |
evalsha(String digest,
ScriptOutputType type,
K... keys)
Eval a pre-loaded script identified by its SHA-1 digest, which must result
in the requested
type . |
<T> T |
evalsha(String digest,
ScriptOutputType type,
K[] keys,
V... values) |
List<Object> |
exec() |
Boolean |
exists(K key) |
Boolean |
expire(K key,
long seconds) |
Boolean |
expireat(K key,
Date timestamp) |
Boolean |
expireat(K key,
long timestamp) |
String |
flushall() |
String |
flushdb() |
V |
get(K key) |
RedisAsyncConnection<K,V> |
getAsync() |
Long |
getbit(K key,
long offset) |
V |
getrange(K key,
long start,
long end) |
RedisClient |
getRedisClient() |
V |
getset(K key,
V value) |
Long |
hdel(K key,
K... fields) |
Boolean |
hexists(K key,
K field) |
V |
hget(K key,
K field) |
Map<K,V> |
hgetall(K key) |
Long |
hincrby(K key,
K field,
long amount) |
String |
hincrbyfloat(K key,
K field,
String amount) |
Set<K> |
hkeys(K key) |
Long |
hlen(K key) |
List<V> |
hmget(K key,
K... fields) |
String |
hmset(K key,
Map<K,V> map) |
Boolean |
hset(K key,
K field,
V value) |
Boolean |
hsetnx(K key,
K field,
V value) |
List<V> |
hvals(K key) |
Long |
incr(K key) |
Long |
incrby(K key,
long amount) |
String |
incrbyfloat(K key,
String amount) |
String |
info() |
String |
info(String section) |
List<K> |
keys(K pattern) |
Date |
lastsave() |
V |
lindex(K key,
long index) |
Long |
linsert(K key,
boolean before,
V pivot,
V value) |
Long |
llen(K key) |
V |
lpop(K key) |
Long |
lpush(K key,
V... values) |
Long |
lpushx(K key,
V value) |
List<V> |
lrange(K key,
long start,
long stop) |
Long |
lrem(K key,
long count,
V value) |
String |
lset(K key,
long index,
V value) |
String |
ltrim(K key,
long start,
long stop) |
List<V> |
mget(K... keys) |
String |
migrate(String host,
int port,
K key,
int db,
long timeout) |
Boolean |
move(K key,
int db) |
String |
mset(Map<K,V> map) |
Boolean |
msetnx(Map<K,V> map) |
String |
multi() |
String |
objectEncoding(K key) |
Long |
objectIdletime(K key) |
Long |
objectRefcount(K key) |
Boolean |
persist(K key) |
Boolean |
pexpire(K key,
long milliseconds) |
Boolean |
pexpireat(K key,
Date timestamp) |
Boolean |
pexpireat(K key,
long timestamp) |
Long |
pfadd(K key,
V... values) |
Long |
pfcount(K key,
K... keys) |
Long |
pfmerge(K destkey,
K... sourceKeys) |
String |
ping() |
String |
psetex(K key,
long millis,
V value) |
Long |
pttl(K key) |
Long |
publish(K channel,
V message) |
String |
quit() |
V |
randomkey() |
String |
rename(K key,
K newKey) |
Boolean |
renamenx(K key,
K newKey) |
String |
restore(K key,
long ttl,
byte[] value) |
V |
rpop(K key) |
V |
rpoplpush(K source,
K destination) |
Long |
rpush(K key,
V... values) |
Long |
rpushx(K key,
V value) |
Long |
sadd(K key,
V... members) |
String |
save() |
Long |
scard(K key) |
List<Boolean> |
scriptExists(String... digests) |
String |
scriptFlush() |
String |
scriptKill() |
String |
scriptLoad(V script) |
Set<V> |
sdiff(K... keys) |
Long |
sdiffstore(K destination,
K... keys) |
String |
select(int db) |
String |
set(K key,
V value) |
Long |
setbit(K key,
long offset,
int value) |
String |
setex(K key,
long seconds,
V value) |
String |
setexnx(K key,
V value,
long millis) |
Boolean |
setnx(K key,
V value) |
Long |
setrange(K key,
long offset,
V value) |
void |
setTimeout(long timeout,
TimeUnit unit)
Set the command timeout for this connection.
|
void |
shutdown()
Deprecated.
|
void |
shutdown(boolean save) |
Set<V> |
sinter(K... keys) |
Long |
sinterstore(K destination,
K... keys) |
Boolean |
sismember(K key,
V member) |
String |
slaveof(String host,
int port) |
String |
slaveofNoOne() |
List<Object> |
slowlogGet() |
List<Object> |
slowlogGet(int count) |
Long |
slowlogLen() |
String |
slowlogReset() |
Set<V> |
smembers(K key) |
Boolean |
smove(K source,
K destination,
V member) |
List<V> |
sort(K key) |
List<V> |
sort(K key,
SortArgs sortArgs) |
Long |
sortStore(K key,
SortArgs sortArgs,
K destination) |
V |
spop(K key) |
V |
srandmember(K key) |
Set<V> |
srandmember(K key,
long count) |
Long |
srem(K key,
V... members) |
ListScanResult<V> |
sscan(K key,
long startValue) |
Long |
strlen(K key) |
Set<V> |
sunion(K... keys) |
Long |
sunionstore(K destination,
K... keys) |
String |
sync() |
List<String> |
time() |
Long |
ttl(K key) |
String |
type(K key) |
String |
unwatch() |
String |
watch(K... keys) |
Long |
zadd(K key,
double score,
V member) |
Long |
zadd(K key,
Object... scoresAndValues) |
Long |
zcard(K key) |
Long |
zcount(K key,
double min,
double max) |
Long |
zcount(K key,
String min,
String max) |
Double |
zincrby(K key,
double amount,
K member) |
Long |
zinterstore(K destination,
K... keys) |
Long |
zinterstore(K destination,
ZStoreArgs storeArgs,
K... keys) |
List<V> |
zrange(K key,
long start,
long stop) |
List<V> |
zrangebyscore(K key,
double min,
double max) |
List<V> |
zrangebyscore(K key,
double min,
double max,
long offset,
long count) |
List<V> |
zrangebyscore(K key,
String min,
String max) |
List<V> |
zrangebyscore(K key,
String min,
String max,
long offset,
long count) |
List<ScoredValue<V>> |
zrangebyscoreWithScores(K key,
double min,
double max) |
List<ScoredValue<V>> |
zrangebyscoreWithScores(K key,
double min,
double max,
long offset,
long count) |
List<ScoredValue<V>> |
zrangebyscoreWithScores(K key,
String min,
String max) |
List<ScoredValue<V>> |
zrangebyscoreWithScores(K key,
String min,
String max,
long offset,
long count) |
List<ScoredValue<V>> |
zrangeWithScores(K key,
long start,
long stop) |
Long |
zrank(K key,
V member) |
Long |
zrem(K key,
V... members) |
Long |
zremrangebyrank(K key,
long start,
long stop) |
Long |
zremrangebyscore(K key,
double min,
double max) |
Long |
zremrangebyscore(K key,
String min,
String max) |
List<V> |
zrevrange(K key,
long start,
long stop) |
List<V> |
zrevrangebyscore(K key,
double max,
double min) |
List<V> |
zrevrangebyscore(K key,
double max,
double min,
long offset,
long count) |
List<V> |
zrevrangebyscore(K key,
String max,
String min) |
List<V> |
zrevrangebyscore(K key,
String max,
String min,
long offset,
long count) |
List<ScoredValue<V>> |
zrevrangebyscoreWithScores(K key,
double max,
double min) |
List<ScoredValue<V>> |
zrevrangebyscoreWithScores(K key,
double max,
double min,
long offset,
long count) |
List<ScoredValue<V>> |
zrevrangebyscoreWithScores(K key,
String max,
String min) |
List<ScoredValue<V>> |
zrevrangebyscoreWithScores(K key,
String max,
String min,
long offset,
long count) |
List<ScoredValue<V>> |
zrevrangeWithScores(K key,
long start,
long stop) |
Long |
zrevrank(K key,
V member) |
ListScanResult<V> |
zscan(K key,
long startValue) |
Double |
zscore(K key,
V member) |
Long |
zunionstore(K destination,
K... keys) |
Long |
zunionstore(K destination,
ZStoreArgs storeArgs,
K... keys) |
protected RedisAsyncConnection<K,V> c
protected long timeout
protected TimeUnit unit
public RedisConnection(RedisAsyncConnection<K,V> c)
c
- Underlying async connection.public RedisClient getRedisClient()
public void setTimeout(long timeout, TimeUnit unit)
timeout
- Command timeout.unit
- Unit of time for the timeout.public String bgrewriteaof()
public String bgsave()
public K clientGetname()
public String clientList()
public String configResetstat()
public Long dbsize()
public String discard()
public byte[] dump(K key)
public <T> T eval(V script, ScriptOutputType type, K... keys)
type
.T
- Expected return type.script
- Lua script to evaluate.type
- Script output type.keys
- Redis keys to pass to script.public <T> T eval(V script, ScriptOutputType type, K[] keys, V... values)
public <T> T evalsha(String digest, ScriptOutputType type, K... keys)
type
.T
- Expected return type.digest
- Lowercase hex string of script's SHA-1 digest.type
- Script output type.keys
- Redis keys to pass to script.public <T> T evalsha(String digest, ScriptOutputType type, K[] keys, V... values)
public String flushall()
public String flushdb()
public String info()
public Date lastsave()
public String multi()
public String ping()
public String quit()
public V randomkey()
public String save()
public String scriptFlush()
public String scriptKill()
public String select(int db)
@Deprecated public void shutdown()
public void shutdown(boolean save)
public String slaveofNoOne()
public Long slowlogLen()
public String slowlogReset()
public String sync()
public String unwatch()
public Long zinterstore(K destination, ZStoreArgs storeArgs, K... keys)
public List<ScoredValue<V>> zrangeWithScores(K key, long start, long stop)
public List<ScoredValue<V>> zrangebyscoreWithScores(K key, double min, double max)
public List<ScoredValue<V>> zrangebyscoreWithScores(K key, String min, String max)
public List<ScoredValue<V>> zrangebyscoreWithScores(K key, double min, double max, long offset, long count)
public List<ScoredValue<V>> zrangebyscoreWithScores(K key, String min, String max, long offset, long count)
public List<ScoredValue<V>> zrevrangeWithScores(K key, long start, long stop)
public List<V> zrevrangebyscore(K key, double max, double min, long offset, long count)
public List<V> zrevrangebyscore(K key, String max, String min, long offset, long count)
public List<ScoredValue<V>> zrevrangebyscoreWithScores(K key, double max, double min)
public List<ScoredValue<V>> zrevrangebyscoreWithScores(K key, String max, String min)
public List<ScoredValue<V>> zrevrangebyscoreWithScores(K key, double max, double min, long offset, long count)
public List<ScoredValue<V>> zrevrangebyscoreWithScores(K key, String max, String min, long offset, long count)
public Long zunionstore(K destination, ZStoreArgs storeArgs, K... keys)
public ListScanResult<V> sscan(K key, long startValue)
public ListScanResult<V> zscan(K key, long startValue)
public RedisAsyncConnection<K,V> getAsync()
public void close()
Copyright © 2014. All rights reserved.