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.redis.op.GeoUnit
import io.vertx.core.json.JsonObject
import io.vertx.core.AsyncResult
import io.vertx.redis.op.RangeOptions
import io.vertx.redis.op.GeoMember
import io.vertx.redis.op.GeoRadiusOptions
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(vertx != null ? (io.vertx.core.Vertx)vertx.getDelegate() : null), 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(vertx != null ? (io.vertx.core.Vertx)vertx.getDelegate() : null, config != null ? new io.vertx.redis.RedisOptions(io.vertx.lang.groovy.InternalHelper.toJsonObject(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) {
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) {
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) {
delegate.auth(password, handler);
return this;
}
/**
* Asynchronously rewrite the append-only file
* @param handler
* @return
*/
public RedisClient bgrewriteaof(Handler> handler) {
delegate.bgrewriteaof(handler);
return this;
}
/**
* Asynchronously save the dataset to disk
* @param handler
* @return
*/
public RedisClient bgsave(Handler> handler) {
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) {
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) {
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) {
delegate.bitop(operation, destkey, keys != null ? (List)keys.collect({it}) : null, 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) {
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) {
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) {
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) {
delegate.blpop(key, seconds, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
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) {
delegate.blpopMany(keys != null ? (List)keys.collect({it}) : null, seconds, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
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) {
delegate.brpop(key, seconds, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
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) {
delegate.brpopMany(keys != null ? (List)keys.collect({it}) : null, seconds, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
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) {
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) {
delegate.clientKill(filter != null ? new io.vertx.redis.op.KillFilter(io.vertx.lang.groovy.InternalHelper.toJsonObject(filter)) : null, handler);
return this;
}
/**
* Get the list of client connections
* @param handler
* @return
*/
public RedisClient clientList(Handler> handler) {
delegate.clientList(handler);
return this;
}
/**
* Get the current connection name
* @param handler
* @return
*/
public RedisClient clientGetname(Handler> handler) {
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) {
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) {
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) {
delegate.clusterAddslots(slots != null ? (List)slots.collect({it}) : null, 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) {
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) {
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) {
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) {
delegate.clusterDelslotsMany(slots != null ? (List)slots.collect({it}) : null, 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) {
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) {
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) {
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) {
delegate.clusterGetkeysinslot(slot, count, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
return this;
}
/**
* Provides info about Redis Cluster node state.
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient clusterInfo(Handler>> handler) {
delegate.clusterInfo(handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
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) {
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) {
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) {
delegate.clusterNodes(handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
delegate.clusterSlaves(nodeId, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
return this;
}
/**
* Get array of Cluster slot to node mappings
* @param handler
* @return
*/
public RedisClient clusterSlots(Handler>> handler) {
delegate.clusterSlots(handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
return this;
}
/**
* Get array of Redis command details
* @param handler
* @return
*/
public RedisClient command(Handler>> handler) {
delegate.command(handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
return this;
}
/**
* Get total number of Redis commands
* @param handler
* @return
*/
public RedisClient commandCount(Handler> handler) {
delegate.commandCount(handler);
return this;
}
/**
* Extract keys given a full Redis command
* @param handler
* @return
*/
public RedisClient commandGetkeys(Handler>> handler) {
delegate.commandGetkeys(handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
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) {
delegate.commandInfo(commands != null ? (List)commands.collect({it}) : null, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
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) {
delegate.configGet(parameter, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
return this;
}
/**
* Rewrite the configuration file with the in memory configuration
* @param handler
* @return
*/
public RedisClient configRewrite(Handler> handler) {
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) {
delegate.configSet(parameter, value, handler);
return this;
}
/**
* Reset the stats returned by INFO
* @param handler
* @return
*/
public RedisClient configResetstat(Handler> handler) {
delegate.configResetstat(handler);
return this;
}
/**
* Return the number of keys in the selected database
* @param handler
* @return
*/
public RedisClient dbsize(Handler> handler) {
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) {
delegate.debugObject(key, handler);
return this;
}
/**
* Make the server crash
* @param handler
* @return
*/
public RedisClient debugSegfault(Handler> handler) {
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) {
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) {
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) {
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) {
delegate.delMany(keys != null ? (List)keys.collect({it}) : null, 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) {
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) {
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) {
delegate.eval(script, keys != null ? (List)keys.collect({it}) : null, args != null ? (List)args.collect({it}) : null, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
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) {
delegate.evalsha(sha1, keys != null ? (List)keys.collect({it}) : null, values != null ? (List)values.collect({it}) : null, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
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) {
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) {
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) {
delegate.expireat(key, seconds, handler);
return this;
}
/**
* Remove all keys from all databases
* @param handler
* @return
*/
public RedisClient flushall(Handler> handler) {
delegate.flushall(handler);
return this;
}
/**
* Remove all keys from the current database
* @param handler
* @return
*/
public RedisClient flushdb(Handler> handler) {
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) {
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) {
delegate.getBinary(key, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture(InternalHelper.safeCreate(ar.result(), io.vertx.groovy.core.buffer.Buffer.class)));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
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) {
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) {
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) {
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) {
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) {
delegate.hdelMany(key, fields != null ? (List)fields.collect({it}) : null, 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) {
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) {
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) {
delegate.hgetall(key, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((Map)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
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) {
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) {
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) {
delegate.hkeys(key, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
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) {
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) {
delegate.hmget(key, fields != null ? (List)fields.collect({it}) : null, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
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) {
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) {
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) {
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) {
delegate.hvals(key, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
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) {
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) {
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) {
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) {
delegate.info(handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((Map)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
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) {
delegate.infoSection(section, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((Map)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
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) {
delegate.keys(pattern, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
return this;
}
/**
* Get the UNIX time stamp of the last successful save to disk
* @param handler
* @return
*/
public RedisClient lastsave(Handler> handler) {
delegate.lastsave(handler);
return this;
}
/**
* Get an element from a list by its index
* @param key Key string
* @param index Index of list element to get
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient lindex(String key, int index, Handler> handler) {
delegate.lindex(key, index, handler);
return this;
}
/**
* Insert an element before or after another element in a list
* @param key Key string
* @param option BEFORE or AFTER
* @param pivot Key to use as a pivot
* @param value Value to be inserted before or after the pivot
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient linsert(String key, InsertOptions option, String pivot, String value, Handler> handler) {
delegate.linsert(key, option, pivot, value, handler);
return this;
}
/**
* Get the length of a list
* @param key String key
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient llen(String key, Handler> handler) {
delegate.llen(key, handler);
return this;
}
/**
* Remove and get the first element in a list
* @param key String key
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient lpop(String key, Handler> handler) {
delegate.lpop(key, handler);
return this;
}
/**
* Prepend one or multiple values to a list
* @param key Key string
* @param values Values to be added at the beginning of the list, one by one
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient lpushMany(String key, List values, Handler> handler) {
delegate.lpushMany(key, values != null ? (List)values.collect({it}) : null, handler);
return this;
}
/**
* Prepend one value to a list
* @param key Key string
* @param value Value to be added at the beginning of the list
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient lpush(String key, String value, Handler> handler) {
delegate.lpush(key, value, handler);
return this;
}
/**
* Prepend a value to a list, only if the list exists
* @param key Key string
* @param value Value to add at the beginning of the list
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient lpushx(String key, String value, Handler> handler) {
delegate.lpushx(key, value, handler);
return this;
}
/**
* Get a range of elements from a list
* @param key Key string
* @param from Start index
* @param to Stop index
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient lrange(String key, long from, long to, Handler>> handler) {
delegate.lrange(key, from, to, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
return this;
}
/**
* Remove elements from a list
* @param key Key string
* @param count Number of first found occurrences equal to $value to remove from the list
* @param value Value to be removed
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient lrem(String key, long count, String value, Handler> handler) {
delegate.lrem(key, count, value, handler);
return this;
}
/**
* Set the value of an element in a list by its index
* @param key Key string
* @param index Position within list
* @param value New value
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient lset(String key, long index, String value, Handler> handler) {
delegate.lset(key, index, value, handler);
return this;
}
/**
* Trim a list to the specified range
* @param key Key string
* @param from Start index
* @param to Stop index
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient ltrim(String key, long from, long to, Handler> handler) {
delegate.ltrim(key, from, to, handler);
return this;
}
/**
* Get the value of the given key
* @param key Key string
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient mget(String key, Handler>> handler) {
delegate.mget(key, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
return this;
}
/**
* Get the values of all the given keys
* @param keys List of keys to get
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient mgetMany(List keys, Handler>> handler) {
delegate.mgetMany(keys != null ? (List)keys.collect({it}) : null, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
return this;
}
/**
* Atomically transfer a key from a Redis instance to another one.
* @param host Destination host
* @param port Destination port
* @param key Key to migrate
* @param destdb Destination database index
* @param timeout
* @param options Migrate options (see MigrateOptions )
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient migrate(String host, int port, String key, int destdb, long timeout, Map options, Handler> handler) {
delegate.migrate(host, port, key, destdb, timeout, options != null ? new io.vertx.redis.op.MigrateOptions(io.vertx.lang.groovy.InternalHelper.toJsonObject(options)) : null, handler);
return this;
}
/**
* Listen for all requests received by the server in real time
* @param handler
* @return
*/
public RedisClient monitor(Handler> handler) {
delegate.monitor(handler);
return this;
}
/**
* Move a key to another database
* @param key Key to migrate
* @param destdb Destination database index
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient move(String key, int destdb, Handler> handler) {
delegate.move(key, destdb, handler);
return this;
}
/**
* Set multiple keys to multiple values
* @param keyvals Key value pairs to set
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient mset(Map keyvals, Handler> handler) {
delegate.mset(keyvals != null ? new io.vertx.core.json.JsonObject(keyvals) : null, handler);
return this;
}
/**
* Set multiple keys to multiple values, only if none of the keys exist
* @param keyvals Key value pairs to set
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient msetnx(Map keyvals, Handler> handler) {
delegate.msetnx(keyvals != null ? new io.vertx.core.json.JsonObject(keyvals) : null, handler);
return this;
}
/**
* Inspect the internals of Redis objects
* @param key Key string
* @param cmd Object sub command
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient object(String key, ObjectCmd cmd, Handler> handler) {
delegate.object(key, cmd, handler);
return this;
}
/**
* Remove the expiration from a key
* @param key Key string
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient persist(String key, Handler> handler) {
delegate.persist(key, handler);
return this;
}
/**
* Set a key's time to live in milliseconds
* @param key String key
* @param millis Time to live in milliseconds
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient pexpire(String key, long millis, Handler> handler) {
delegate.pexpire(key, millis, handler);
return this;
}
/**
* Set the expiration for a key as a UNIX timestamp specified in milliseconds
* @param key Key string
* @param millis Expiry time as Unix timestamp in milliseconds
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient pexpireat(String key, long millis, Handler> handler) {
delegate.pexpireat(key, millis, handler);
return this;
}
/**
* Adds the specified element to the specified HyperLogLog.
* @param key Key string
* @param element Element to add
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient pfadd(String key, String element, Handler> handler) {
delegate.pfadd(key, element, handler);
return this;
}
/**
* Adds the specified elements to the specified HyperLogLog.
* @param key Key string
* @param elements Elementa to add
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient pfaddMany(String key, List elements, Handler> handler) {
delegate.pfaddMany(key, elements != null ? (List)elements.collect({it}) : null, handler);
return this;
}
/**
* Return the approximated cardinality of the set observed by the HyperLogLog at key.
* @param key Key string
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient pfcount(String key, Handler> handler) {
delegate.pfcount(key, handler);
return this;
}
/**
* Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).
* @param keys List of keys
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient pfcountMany(List keys, Handler> handler) {
delegate.pfcountMany(keys != null ? (List)keys.collect({it}) : null, handler);
return this;
}
/**
* Merge N different HyperLogLogs into a single one.
* @param destkey Destination key
* @param keys List of source keys
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient pfmerge(String destkey, List keys, Handler> handler) {
delegate.pfmerge(destkey, keys != null ? (List)keys.collect({it}) : null, handler);
return this;
}
/**
* Ping the server
* @param handler
* @return
*/
public RedisClient ping(Handler> handler) {
delegate.ping(handler);
return this;
}
/**
* Set the value and expiration in milliseconds of a key
* @param key Key string
* @param millis Number of milliseconds until the key expires
* @param value New value for key
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient psetex(String key, long millis, String value, Handler> handler) {
delegate.psetex(key, millis, value, handler);
return this;
}
/**
* Listen for messages published to channels matching the given pattern
* @param pattern Pattern string
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient psubscribe(String pattern, Handler>> handler) {
delegate.psubscribe(pattern, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
return this;
}
/**
* Listen for messages published to channels matching the given patterns
* @param patterns List of patterns
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient psubscribeMany(List patterns, Handler>> handler) {
delegate.psubscribeMany(patterns != null ? (List)patterns.collect({it}) : null, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
return this;
}
/**
* Lists the currently active channels - only those matching the pattern
* @param pattern A glob-style pattern - an empty string means no pattern
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient pubsubChannels(String pattern, Handler>> handler) {
delegate.pubsubChannels(pattern, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
return this;
}
/**
* Returns the number of subscribers (not counting clients subscribed to patterns) for the specified channels
* @param channels List of channels
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient pubsubNumsub(List channels, Handler>> handler) {
delegate.pubsubNumsub(channels != null ? (List)channels.collect({it}) : null, handler != null ? new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture((List)InternalHelper.wrapObject(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
} : null);
return this;
}
/**
* Returns the number of subscriptions to patterns (that are performed using the PSUBSCRIBE command)
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient pubsubNumpat(Handler> handler) {
delegate.pubsubNumpat(handler);
return this;
}
/**
* Get the time to live for a key in milliseconds
* @param key Key string
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient pttl(String key, Handler> handler) {
delegate.pttl(key, handler);
return this;
}
/**
* Post a message to a channel
* @param channel Channel key
* @param message Message to send to channel
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient publish(String channel, String message, Handler> handler) {
delegate.publish(channel, message, handler);
return this;
}
/**
* Stop listening for messages posted to channels matching the given patterns
* @param patterns List of patterns to match against
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient punsubscribe(List patterns, Handler> handler) {
delegate.punsubscribe(patterns != null ? (List)patterns.collect({it}) : null, handler);
return this;
}
/**
* Return a random key from the keyspace
* @param handler
* @return
*/
public RedisClient randomkey(Handler> handler) {
delegate.randomkey(handler);
return this;
}
/**
* Rename a key
* @param key Key string to be renamed
* @param newkey New key string
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient rename(String key, String newkey, Handler> handler) {
delegate.rename(key, newkey, handler);
return this;
}
/**
* Rename a key, only if the new key does not exist
* @param key Key string to be renamed
* @param newkey New key string
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient renamenx(String key, String newkey, Handler> handler) {
delegate.renamenx(key, newkey, handler);
return this;
}
/**
* Create a key using the provided serialized value, previously obtained using DUMP.
* @param key Key string
* @param millis Expiry time in milliseconds to set on the key
* @param serialized Serialized form of the key value as obtained using DUMP
* @param handler Handler for the result of this call.
* @return
*/
public RedisClient restore(String key, long millis, String serialized, Handler> handler) {
delegate.restore(key, millis, serialized, handler);
return this;
}
/**
* Return the role of the instance in the context of replication
* @param handler
* @return
*/
public RedisClient role(Handler