Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
io.vertx.groovy.redis.RedisClient.groovy Maven / Gradle / Ivy
/*
* Copyright 2014 Red Hat, Inc.
*
* Red Hat licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.vertx.groovy.redis;
import groovy.transform.CompileStatic
import io.vertx.lang.groovy.InternalHelper
import io.vertx.core.json.JsonObject
import io.vertx.redis.op.BitOperation
import io.vertx.redis.op.ResetOptions
import io.vertx.redis.op.ObjectCmd
import io.vertx.redis.op.KillFilter
import java.util.Map
import io.vertx.core.json.JsonObject
import io.vertx.core.AsyncResult
import io.vertx.redis.op.RangeOptions
import io.vertx.redis.op.InsertOptions
import io.vertx.redis.op.AggregateOptions
import io.vertx.redis.op.SetOptions
import io.vertx.redis.op.SortOptions
import io.vertx.redis.op.MigrateOptions
import io.vertx.redis.op.ScanOptions
import io.vertx.groovy.core.Vertx
import io.vertx.redis.op.FailoverOptions
import io.vertx.redis.op.SlotCmd
import io.vertx.redis.op.RangeLimitOptions
import io.vertx.redis.op.LimitOptions
import io.vertx.core.json.JsonArray
import java.util.List
import io.vertx.groovy.core.buffer.Buffer
import io.vertx.redis.RedisOptions
import io.vertx.core.Handler
@CompileStatic
public class RedisClient {
private final def io.vertx.redis.RedisClient delegate;
public RedisClient(Object delegate) {
this.delegate = (io.vertx.redis.RedisClient) delegate;
}
public Object getDelegate() {
return delegate;
}
public static RedisClient create(Vertx vertx) {
def ret= InternalHelper.safeCreate(io.vertx.redis.RedisClient.create((io.vertx.core.Vertx)vertx.getDelegate()), io.vertx.groovy.redis.RedisClient.class);
return ret;
}
public static RedisClient create(Vertx vertx, Map config) {
def ret= InternalHelper.safeCreate(io.vertx.redis.RedisClient.create((io.vertx.core.Vertx)vertx.getDelegate(), config != null ? new io.vertx.redis.RedisOptions(new io.vertx.core.json.JsonObject(config)) : null), io.vertx.groovy.redis.RedisClient.class);
return ret;
}
/**
* Close the client - when it is fully closed the handler will be called.
* @param handler
*/
public void close(Handler> handler) {
this.delegate.close(handler);
}
/**
* Append a value to a key
* @param key Key string
* @param value Value to append
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient append(String key, String value, Handler> handler) {
this.delegate.append(key, value, handler);
return this;
}
/**
* Authenticate to the server
* @param password Password for authentication
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient auth(String password, Handler> handler) {
this.delegate.auth(password, handler);
return this;
}
/**
* Asynchronously rewrite the append-only file
* @param handler
* @return
*/
public RedisClient bgrewriteaof(Handler> handler) {
this.delegate.bgrewriteaof(handler);
return this;
}
/**
* Asynchronously save the dataset to disk
* @param handler
* @return
*/
public RedisClient bgsave(Handler> handler) {
this.delegate.bgsave(handler);
return this;
}
/**
* Count set bits in a string
* @param key Key string
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient bitcount(String key, Handler> handler) {
this.delegate.bitcount(key, handler);
return this;
}
/**
* Count set bits in a string
* @param key Key string
* @param start Start index
* @param end End index
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient bitcountRange(String key, long start, long end, Handler> handler) {
this.delegate.bitcountRange(key, start, end, handler);
return this;
}
/**
* Perform bitwise operations between strings
* @param operation Bitwise operation to perform
* @param destkey Destination key where result is stored
* @param keys List of keys on which to perform the operation
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient bitop(BitOperation operation, String destkey, List keys, Handler> handler) {
this.delegate.bitop(operation, destkey, keys, handler);
return this;
}
/**
* Find first bit set or clear in a string
* @param key Key string
* @param bit What bit value to look for - must be 1, or 0
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient bitpos(String key, int bit, Handler> handler) {
this.delegate.bitpos(key, bit, handler);
return this;
}
/**
* Find first bit set or clear in a string
*
* See also bitposRange() method, which takes start, and stop offset.
* @param key Key string
* @param bit What bit value to look for - must be 1, or 0
* @param start Start offset
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient bitposFrom(String key, int bit, int start, Handler> handler) {
this.delegate.bitposFrom(key, bit, start, handler);
return this;
}
/**
* Find first bit set or clear in a string
*
* Note: when both start, and stop offsets are specified,
* behaviour is slightly different than if only start is specified
* @param key Key string
* @param bit What bit value to look for - must be 1, or 0
* @param start Start offset
* @param stop End offset - inclusive
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient bitposRange(String key, int bit, int start, int stop, Handler> handler) {
this.delegate.bitposRange(key, bit, start, stop, handler);
return this;
}
/**
* Remove and get the first element in a list, or block until one is available
* @param key Key string identifying a list to watch
* @param seconds Timeout in seconds
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient blpop(String key, int seconds, Handler>> handler) {
this.delegate.blpop(key, seconds, new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((List)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Remove and get the first element in any of the lists, or block until one is available
* @param keys List of key strings identifying lists to watch
* @param seconds Timeout in seconds
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient blpopMany(List keys, int seconds, Handler>> handler) {
this.delegate.blpopMany(keys, seconds, new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((List)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Remove and get the last element in a list, or block until one is available
* @param key Key string identifying a list to watch
* @param seconds Timeout in seconds
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient brpop(String key, int seconds, Handler>> handler) {
this.delegate.brpop(key, seconds, new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((List)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Remove and get the last element in any of the lists, or block until one is available
* @param keys List of key strings identifying lists to watch
* @param seconds Timeout in seconds
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient brpopMany(List keys, int seconds, Handler>> handler) {
this.delegate.brpopMany(keys, seconds, new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((List)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Pop a value from a list, push it to another list and return it; or block until one is available
* @param key Key string identifying the source list
* @param destkey Key string identifying the destination list
* @param seconds Timeout in seconds
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient brpoplpush(String key, String destkey, int seconds, Handler> handler) {
this.delegate.brpoplpush(key, destkey, seconds, handler);
return this;
}
/**
* Kill the connection of a client
* @param filter Filter options (see KillFilter )
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clientKill(Map filter = [:], Handler> handler) {
this.delegate.clientKill(filter != null ? new io.vertx.redis.op.KillFilter(new io.vertx.core.json.JsonObject(filter)) : null, handler);
return this;
}
/**
* Get the list of client connections
* @param handler
* @return
*/
public RedisClient clientList(Handler> handler) {
this.delegate.clientList(handler);
return this;
}
/**
* Get the current connection name
* @param handler
* @return
*/
public RedisClient clientGetname(Handler> handler) {
this.delegate.clientGetname(handler);
return this;
}
/**
* Stop processing commands from clients for some time
* @param millis Pause time in milliseconds
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clientPause(long millis, Handler> handler) {
this.delegate.clientPause(millis, handler);
return this;
}
/**
* Set the current connection name
* @param name New name for current connection
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clientSetname(String name, Handler> handler) {
this.delegate.clientSetname(name, handler);
return this;
}
/**
* Assign new hash slots to receiving node.
* @param slots
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterAddslots(List slots, Handler> handler) {
this.delegate.clusterAddslots(slots, handler);
return this;
}
/**
* Return the number of failure reports active for a given node.
* @param nodeId
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterCountFailureReports(String nodeId, Handler> handler) {
this.delegate.clusterCountFailureReports(nodeId, handler);
return this;
}
/**
* Return the number of local keys in the specified hash slot.
* @param slot
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterCountkeysinslot(long slot, Handler> handler) {
this.delegate.clusterCountkeysinslot(slot, handler);
return this;
}
/**
* Set hash slots as unbound in receiving node.
* @param slot
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterDelslots(long slot, Handler> handler) {
this.delegate.clusterDelslots(slot, handler);
return this;
}
/**
* Set hash slots as unbound in receiving node.
* @param slots
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterDelslotsMany(List slots, Handler> handler) {
this.delegate.clusterDelslotsMany(slots, handler);
return this;
}
/**
* Forces a slave to perform a manual failover of its master.
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterFailover(Handler> handler) {
this.delegate.clusterFailover(handler);
return this;
}
/**
* Forces a slave to perform a manual failover of its master.
* @param options
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterFailOverWithOptions(FailoverOptions options, Handler> handler) {
this.delegate.clusterFailOverWithOptions(options, handler);
return this;
}
/**
* Remove a node from the nodes table.
* @param nodeId
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterForget(String nodeId, Handler> handler) {
this.delegate.clusterForget(nodeId, handler);
return this;
}
/**
* Return local key names in the specified hash slot.
* @param slot
* @param count
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterGetkeysinslot(long slot, long count, Handler>> handler) {
this.delegate.clusterGetkeysinslot(slot, count, new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((List)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Provides info about Redis Cluster node state.
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterInfo(Handler>> handler) {
this.delegate.clusterInfo(new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((List)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Returns the hash slot of the specified key.
* @param key
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterKeyslot(String key, Handler> handler) {
this.delegate.clusterKeyslot(key, handler);
return this;
}
/**
* Force a node cluster to handshake with another node.
* @param ip
* @param port
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterMeet(String ip, long port, Handler> handler) {
this.delegate.clusterMeet(ip, port, handler);
return this;
}
/**
* Get Cluster config for the node.
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterNodes(Handler>> handler) {
this.delegate.clusterNodes(new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((List)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Reconfigure a node as a slave of the specified master node.
* @param nodeId
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterReplicate(String nodeId, Handler> handler) {
this.delegate.clusterReplicate(nodeId, handler);
return this;
}
/**
* Reset a Redis Cluster node.
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterReset(Handler> handler) {
this.delegate.clusterReset(handler);
return this;
}
/**
* Reset a Redis Cluster node.
* @param options
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterResetWithOptions(ResetOptions options, Handler> handler) {
this.delegate.clusterResetWithOptions(options, handler);
return this;
}
/**
* Forces the node to save cluster state on disk.
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterSaveconfig(Handler> handler) {
this.delegate.clusterSaveconfig(handler);
return this;
}
/**
* Set the configuration epoch in a new node.
* @param epoch
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterSetConfigEpoch(long epoch, Handler> handler) {
this.delegate.clusterSetConfigEpoch(epoch, handler);
return this;
}
/**
* Bind an hash slot to a specific node.
* @param slot
* @param subcommand
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterSetslot(long slot, SlotCmd subcommand, Handler> handler) {
this.delegate.clusterSetslot(slot, subcommand, handler);
return this;
}
/**
* Bind an hash slot to a specific node.
* @param slot
* @param subcommand
* @param nodeId
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterSetslotWithNode(long slot, SlotCmd subcommand, String nodeId, Handler> handler) {
this.delegate.clusterSetslotWithNode(slot, subcommand, nodeId, handler);
return this;
}
/**
* List slave nodes of the specified master node.
* @param nodeId
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterSlaves(String nodeId, Handler>> handler) {
this.delegate.clusterSlaves(nodeId, new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((List)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Get array of Cluster slot to node mappings
* @param handler
* @return
*/
public RedisClient clusterSlots(Handler>> handler) {
this.delegate.clusterSlots(new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((List)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Get array of Redis command details
* @param handler
* @return
*/
public RedisClient command(Handler>> handler) {
this.delegate.command(new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((List)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Get total number of Redis commands
* @param handler
* @return
*/
public RedisClient commandCount(Handler> handler) {
this.delegate.commandCount(handler);
return this;
}
/**
* Extract keys given a full Redis command
* @param handler
* @return
*/
public RedisClient commandGetkeys(Handler>> handler) {
this.delegate.commandGetkeys(new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((List)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Get array of specific Redis command details
* @param commands List of commands to get info for
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient commandInfo(List commands, Handler>> handler) {
this.delegate.commandInfo(commands, new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((List)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Get the value of a configuration parameter
* @param parameter Configuration parameter
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient configGet(String parameter, Handler>> handler) {
this.delegate.configGet(parameter, new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((List)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Rewrite the configuration file with the in memory configuration
* @param handler
* @return
*/
public RedisClient configRewrite(Handler> handler) {
this.delegate.configRewrite(handler);
return this;
}
/**
* Set a configuration parameter to the given value
* @param parameter Configuration parameter
* @param value New value
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient configSet(String parameter, String value, Handler> handler) {
this.delegate.configSet(parameter, value, handler);
return this;
}
/**
* Reset the stats returned by INFO
* @param handler
* @return
*/
public RedisClient configResetstat(Handler> handler) {
this.delegate.configResetstat(handler);
return this;
}
/**
* Return the number of keys in the selected database
* @param handler
* @return
*/
public RedisClient dbsize(Handler> handler) {
this.delegate.dbsize(handler);
return this;
}
/**
* Get debugging information about a key
* @param key Key string
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient debugObject(String key, Handler> handler) {
this.delegate.debugObject(key, handler);
return this;
}
/**
* Make the server crash
* @param handler
* @return
*/
public RedisClient debugSegfault(Handler> handler) {
this.delegate.debugSegfault(handler);
return this;
}
/**
* Decrement the integer value of a key by one
* @param key Key string
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient decr(String key, Handler> handler) {
this.delegate.decr(key, handler);
return this;
}
/**
* Decrement the integer value of a key by the given number
* @param key Key string
* @param decrement Value by which to decrement
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient decrby(String key, long decrement, Handler> handler) {
this.delegate.decrby(key, decrement, handler);
return this;
}
/**
* Delete a key
* @param key Keys to delete
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient del(String key, Handler> handler) {
this.delegate.del(key, handler);
return this;
}
/**
* Delete many keys
* @param keys List of keys to delete
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient delMany(List keys, Handler> handler) {
this.delegate.delMany(keys, handler);
return this;
}
/**
* Discard all commands issued after MULTI
* @param handler
* @return
*/
public RedisClient discard(Handler> handler) {
this.delegate.discard(handler);
return this;
}
/**
* Return a serialized version of the value stored at the specified key.
* @param key Key string
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient dump(String key, Handler> handler) {
this.delegate.dump(key, handler);
return this;
}
/**
* Echo the given string
* @param message String to echo
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient echo(String message, Handler> handler) {
this.delegate.echo(message, handler);
return this;
}
/**
* Execute a Lua script server side. Due to the dynamic nature of this command any response type could be returned
* for This reason and to ensure type safety the reply is always guaranteed to be a JsonArray.
*
* When a reply if for example a String the handler will be called with a JsonArray with a single element containing
* the String.
* @param script Lua script to evaluate
* @param keys List of keys
* @param args List of argument values
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient eval(String script, List keys, List args, Handler>> handler) {
this.delegate.eval(script, keys, args, new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((List)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Execute a Lua script server side. Due to the dynamic nature of this command any response type could be returned
* for This reason and to ensure type safety the reply is always guaranteed to be a JsonArray.
*
* When a reply if for example a String the handler will be called with a JsonArray with a single element containing
* the String.
* @param sha1 SHA1 digest of the script cached on the server
* @param keys List of keys
* @param values List of values
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient evalsha(String sha1, List keys, List values, Handler>> handler) {
this.delegate.evalsha(sha1, keys, values, new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((List)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Execute all commands issued after MULTI
* @param handler
* @return
*/
public RedisClient exec(Handler>> handler) {
this.delegate.exec(new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((List)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Determine if a key exists
* @param key Key string
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient exists(String key, Handler> handler) {
this.delegate.exists(key, handler);
return this;
}
/**
* Set a key's time to live in seconds
* @param key Key string
* @param seconds Time to live in seconds
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient expire(String key, int seconds, Handler> handler) {
this.delegate.expire(key, seconds, handler);
return this;
}
/**
* Set the expiration for a key as a UNIX timestamp
* @param key Key string
* @param seconds Expiry time as Unix timestamp in seconds
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient expireat(String key, long seconds, Handler> handler) {
this.delegate.expireat(key, seconds, handler);
return this;
}
/**
* Remove all keys from all databases
* @param handler
* @return
*/
public RedisClient flushall(Handler> handler) {
this.delegate.flushall(handler);
return this;
}
/**
* Remove all keys from the current database
* @param handler
* @return
*/
public RedisClient flushdb(Handler> handler) {
this.delegate.flushdb(handler);
return this;
}
/**
* Get the value of a key
* @param key Key string
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient get(String key, Handler> handler) {
this.delegate.get(key, handler);
return this;
}
/**
* Get the value of a key - without decoding as utf-8
* @param key Key string
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient getBinary(String key, Handler> handler) {
this.delegate.getBinary(key, new Handler>() {
public void handle(AsyncResult event) {
AsyncResult f
if (event.succeeded()) {
f = InternalHelper.result(new Buffer(event.result()))
} else {
f = InternalHelper.failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Returns the bit value at offset in the string value stored at key
* @param key Key string
* @param offset Offset in bits
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient getbit(String key, long offset, Handler> handler) {
this.delegate.getbit(key, offset, handler);
return this;
}
/**
* Get a substring of the string stored at a key
* @param key Key string
* @param start Start offset
* @param end End offset - inclusive
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient getrange(String key, long start, long end, Handler> handler) {
this.delegate.getrange(key, start, end, handler);
return this;
}
/**
* Set the string value of a key and return its old value
* @param key Key of which value to set
* @param value New value for the key
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient getset(String key, String value, Handler> handler) {
this.delegate.getset(key, value, handler);
return this;
}
/**
* Delete one or more hash fields
* @param key Key string
* @param field Field name
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient hdel(String key, String field, Handler> handler) {
this.delegate.hdel(key, field, handler);
return this;
}
/**
* Delete one or more hash fields
* @param key Key string
* @param fields Field names
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient hdelMany(String key, List fields, Handler> handler) {
this.delegate.hdelMany(key, fields, handler);
return this;
}
/**
* Determine if a hash field exists
* @param key Key string
* @param field Field name
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient hexists(String key, String field, Handler> handler) {
this.delegate.hexists(key, field, handler);
return this;
}
/**
* Get the value of a hash field
* @param key Key string
* @param field Field name
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient hget(String key, String field, Handler> handler) {
this.delegate.hget(key, field, handler);
return this;
}
/**
* Get all the fields and values in a hash
* @param key Key string
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient hgetall(String key, Handler>> handler) {
this.delegate.hgetall(key, new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((Map)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Increment the integer value of a hash field by the given number
* @param key Key string
* @param field Field name
* @param increment Value by which to increment
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient hincrby(String key, String field, long increment, Handler> handler) {
this.delegate.hincrby(key, field, increment, handler);
return this;
}
/**
* Increment the float value of a hash field by the given amount
* @param key Key string
* @param field Field name
* @param increment Value by which to increment
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient hincrbyfloat(String key, String field, double increment, Handler> handler) {
this.delegate.hincrbyfloat(key, field, increment, handler);
return this;
}
/**
* Get all the fields in a hash
* @param key Key string
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient hkeys(String key, Handler>> handler) {
this.delegate.hkeys(key, new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((List)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Get the number of fields in a hash
* @param key Key string
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient hlen(String key, Handler> handler) {
this.delegate.hlen(key, handler);
return this;
}
/**
* Get the values of all the given hash fields
* @param key Key string
* @param fields Field names
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient hmget(String key, List fields, Handler>> handler) {
this.delegate.hmget(key, fields, new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((List)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Set multiple hash fields to multiple values
* @param key Key string
* @param values Map of field:value pairs
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient hmset(String key, Map values, Handler> handler) {
this.delegate.hmset(key, values != null ? new io.vertx.core.json.JsonObject(values) : null, handler);
return this;
}
/**
* Set the string value of a hash field
* @param key Key string
* @param field Field name
* @param value New value
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient hset(String key, String field, String value, Handler> handler) {
this.delegate.hset(key, field, value, handler);
return this;
}
/**
* Set the value of a hash field, only if the field does not exist
* @param key Key string
* @param field Field name
* @param value New value
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient hsetnx(String key, String field, String value, Handler> handler) {
this.delegate.hsetnx(key, field, value, handler);
return this;
}
/**
* Get all the values in a hash
* @param key Key string
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient hvals(String key, Handler>> handler) {
this.delegate.hvals(key, new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((List)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Increment the integer value of a key by one
* @param key Key string
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient incr(String key, Handler> handler) {
this.delegate.incr(key, handler);
return this;
}
/**
* Increment the integer value of a key by the given amount
* @param key Key string
* @param increment Value by which to increment
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient incrby(String key, long increment, Handler> handler) {
this.delegate.incrby(key, increment, handler);
return this;
}
/**
* Increment the float value of a key by the given amount
* @param key Key string
* @param increment Value by which to increment
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient incrbyfloat(String key, double increment, Handler> handler) {
this.delegate.incrbyfloat(key, increment, handler);
return this;
}
/**
* Get information and statistics about the server
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient info(Handler>> handler) {
this.delegate.info(new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((Map)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Get information and statistics about the server
* @param section Specific section of information to return
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient infoSection(String section, Handler>> handler) {
this.delegate.infoSection(section, new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.>result((Map)InternalHelper.wrapObject(event.result()))
} else {
f = InternalHelper.>failure(event.cause())
}
handler.handle(f)
}
});
return this;
}
/**
* Find all keys matching the given pattern
* @param pattern Pattern to limit the keys returned
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient keys(String pattern, Handler>> handler) {
this.delegate.keys(pattern, new Handler>() {
public void handle(AsyncResult event) {
AsyncResult> f
if (event.succeeded()) {
f = InternalHelper.