Interface RedisServerCommands

  • All Known Implementing Classes:
    RedisServerConnection

    public interface RedisServerCommands
    Interface of Redis server commands.
    Author:
    Matthew Tropiano
    • Method Detail

      • bgrewriteaof

        boolean bgrewriteaof()

        From http://redis.io/commands/bgrewriteaof:

        Available since 1.0.0.

        Instruct Redis to start an Append Only File rewrite process. The rewrite will create a small optimized version of the current Append Only File.

        Returns:
        always true.
      • bgsave

        boolean bgsave()

        From http://redis.io/commands/bgsave:

        Available since 1.0.0.

        Save the DB in background. The OK code is immediately returned. Redis forks, the parent continues to serve the clients, the child saves the DB on disk then exits. A client my be able to check if the operation succeeded using the lastsave() command.

        Returns:
        always true.
      • clientKill

        boolean clientKill​(String ip,
                           int port)

        From http://redis.io/commands/client-kill:

        Available since 2.4.0.

        Time complexity: O(N) where N is the number of client connections

        The CLIENT KILL command closes a given client connection identified by ip:port.

        Parameters:
        ip - the IP address or hostname.
        port - the port number.
        Returns:
        true once the client connection was closed.
      • clientList

        String[] clientList()

        From http://redis.io/commands/client-list:

        Available since 2.4.0.

        Time complexity: O(N) where N is the number of client connections

        The CLIENT LIST command returns information and statistics about the client connections server in a mostly human readable format.

        Returns:
        a list of client strings that describe each connection.
      • clientPause

        boolean clientPause​(long millis)

        From http://redis.io/commands/client-pause:

        Available since 2.9.50.

        Time complexity: O(1)

        CLIENT PAUSE is a connections control command able to suspend all the Redis clients for the specified amount of time (in milliseconds).

        Parameters:
        millis - the amount of time in milliseconds.
        Returns:
        always true.
      • configGet

        String configGet​(String configKey)

        From http://redis.io/commands/config-get:

        Available since 2.0.0.

        The CONFIG GET command is used to read the configuration parameters of a running Redis server. Not all the configuration parameters are supported in Redis 2.4, while Redis 2.6 can read the whole configuration of a server using this command.

        Parameters:
        configKey - the config key.
        Returns:
        the config value.
      • configRewrite

        boolean configRewrite()

        From http://redis.io/commands/config-rewrite:

        Available since 2.8.0.

        The CONFIG REWRITE command rewrites the redis.conf file the server was started with, applying the minimal changes needed to make it reflecting the configuration currently used by the server, that may be different compared to the original one because of the use of the configSet(java.lang.String, java.lang.String) command.

        Returns:
        always true.
      • configSet

        boolean configSet​(String parameter,
                          String value)

        From http://redis.io/commands/config-set:

        Available since 2.0.0.

        The CONFIG SET command is used in order to reconfigure the server at run time without the need to restart Redis. You can change both trivial parameters or switch from one to another persistence option using this command.

        Parameters:
        parameter - the parameter.
        value - the value.
        Returns:
        always true.
      • dbsize

        long dbsize()

        From http://redis.io/commands/dbsize:

        Available since 1.0.0.

        Return the number of keys in the currently-selected database.

        Returns:
        the number of keys.
      • flushall

        boolean flushall()

        From http://redis.io/commands/flushall:

        Available since 1.0.0.

        Delete all the keys of all the existing databases, not just the currently selected one. This command never fails.

        Returns:
        always true.
      • flushdb

        boolean flushdb()

        From http://redis.io/commands/flushdb:

        Available since 1.0.0.

        Delete all the keys of the currently selected DB. This command never fails.

        Returns:
        true if successful, false otherwise.
      • info

        String info()

        From http://redis.io/commands/info:

        Available since 1.0.0.

        The INFO command returns information and statistics about the server in a format that is simple to parse by computers and easy to read by humans.

        Returns:
        a collection of text lines parseable for info.
      • info

        String info​(String section)

        From http://redis.io/commands/info:

        Available since 1.0.0.

        The INFO command returns information and statistics about the server in a format that is simple to parse by computers and easy to read by humans.

        Parameters:
        section - the section to get info on.
        Returns:
        a collection of text lines parseable for info.
      • lastsave

        long lastsave()

        From http://redis.io/commands/lastsave:

        Available since 1.0.0.

        Return the UNIX TIME of the last DB save executed with success. A client may check if a bgsave() command succeeded reading the lastsave() value, then issuing a bgsave() command and checking at regular intervals every N seconds if lastsave() changed.

        Returns:
        a UNIX time stamp.
      • object

        RedisObject object​(String subcommand,
                           String key)

        From http://redis.io/commands/object:

        Available since 2.2.3.

        Time complexity: O(1).

        The object command allows to inspect the internals of Redis Objects associated with keys. It is useful for debugging or to understand if your keys are using the specially encoded data types to save space. Your application may also use the information reported by the object command to implement application level key eviction policies when using Redis as a Cache.

        This call is here in order to support commands that don't have signatures.

        Parameters:
        subcommand - the object subcommand.
        key - the key to operate on.
        Returns:
        the Redis object returned.
      • objectRefcount

        long objectRefcount​(String key)

        From http://redis.io/commands/object:

        Available since 2.2.3.

        Time complexity: O(1).

        The object command allows to inspect the internals of Redis Objects associated with keys. It is useful for debugging or to understand if your keys are using the specially encoded data types to save space. Your application may also use the information reported by the object command to implement application level key eviction policies when using Redis as a Cache.

        Parameters:
        key - the key to count.
        Returns:
        the number of references of the value associated with the specified key. This command is mainly useful for debugging.
      • objectEncoding

        EncodingType objectEncoding​(String key)

        From http://redis.io/commands/object:

        Available since 2.2.3.

        Time complexity: O(1).

        The object command allows to inspect the internals of Redis Objects associated with keys. It is useful for debugging or to understand if your keys are using the specially encoded data types to save space. Your application may also use the information reported by the object command to implement application level key eviction policies when using Redis as a Cache.

        Parameters:
        key - the key to inspect.
        Returns:
        the kind of internal representation used in order to store the value associated with a key, or null for missing key.
      • objectIdletime

        long objectIdletime​(String key)

        From http://redis.io/commands/object:

        Available since 2.2.3.

        Time complexity: O(1).

        The object command allows to inspect the internals of Redis Objects associated with keys. It is useful for debugging or to understand if your keys are using the specially encoded data types to save space. Your application may also use the information reported by the object command to implement application level key eviction policies when using Redis as a Cache.

        Parameters:
        key - the key to inspect.
        Returns:
        the number of seconds since the object stored at the specified key is idle (not requested by read or write operations). While the value is returned in seconds the actual resolution of this timer is 10 seconds, but may vary in future implementations.
      • pubsub

        RedisObject pubsub​(String subcommand,
                           String... arguments)

        From http://redis.io/commands/pubsub:

        Available since 2.8.0.

        Time complexity: O(N) for the CHANNELS subcommand, where N is the number of active channels, and assuming constant time pattern matching (relatively short channels and patterns). O(N) for the NUMSUB subcommand, where N is the number of requested channels. O(1) for the NUMPAT subcommand.

        The PUBSUB command is an introspection command that allows to inspect the state of the Pub/Sub subsystem.

        This call is here in order to support commands that don't have signatures.

        Parameters:
        subcommand - the pubsub subcommand.
        arguments - the additional arguments.
        Returns:
        the Redis object returned.
      • pubsubChannels

        String[] pubsubChannels​(String pattern)

        From http://redis.io/commands/pubsub:

        Available since 2.8.0.

        Time complexity: O(N), where N is the number of active channels, and assuming constant time pattern matching (relatively short channels and patterns).

        The PUBSUB command is an introspection command that allows to inspect the state of the Pub/Sub subsystem.

        Parameters:
        pattern - the pattern to search for.
        Returns:
        a list of active channels, optionally matching the specified pattern.
      • pubsubNumsub

        String[] pubsubNumsub​(String... arguments)

        From http://redis.io/commands/pubsub:

        Available since 2.8.0.

        Time complexity: O(N), where N is the number of requested channels.

        The PUBSUB command is an introspection command that allows to inspect the state of the Pub/Sub subsystem.

        Parameters:
        arguments - the channel names.
        Returns:
        a list of channels and number of subscribers for every channel. The format is channel, count, channel, count, ..., so the list is flat. The order in which the channels are listed is the same as the order of the channels specified in the command call.
      • pubsubNumpat

        long pubsubNumpat()

        From http://redis.io/commands/pubsub:

        Available since 2.8.0.

        Time complexity: O(1) for the NUMPAT subcommand.

        The PUBSUB command is an introspection command that allows to inspect the state of the Pub/Sub subsystem.

        Returns:
        the number of patterns all the clients are subscribed to.
      • save

        boolean save()

        From http://redis.io/commands/save:

        Available since 1.0.0.

        The SAVE commands performs a synchronous save of the dataset producing a point in time snapshot of all the data inside the Redis instance, in the form of an RDB file.

        Returns:
        always true.
      • shutdown

        void shutdown​(boolean save)

        From http://redis.io/commands/shutdown:

        Available since 1.0.0.

        The command behavior is the following:

        Parameters:
        save - if true, force save before shutdown.
      • slaveof

        boolean slaveof​(String host,
                        String port)

        From http://redis.io/commands/slaveof:

        Available since 1.0.0.

        The SLAVEOF command can change the replication settings of a slave on the fly. If a Redis server is already acting as slave, the command SLAVEOF NO ONE will turn off the replication, turning the Redis server into a MASTER. In the proper form slaveof(String, String) hostname port will make the server a slave of another server listening at the specified hostname and port.

        Parameters:
        host - the hostname.
        port - the port.
        Returns:
        always true.
      • slaveofNoOne

        boolean slaveofNoOne()

        From http://redis.io/commands/slaveof:

        Available since 1.0.0.

        The SLAVEOF command can change the replication settings of a slave on the fly. If a Redis server is already acting as slave, the command SLAVEOF NO ONE will turn off the replication, turning the Redis server into a MASTER. In the proper form slaveof(String, String) hostname port will make the server a slave of another server listening at the specified hostname and port.

        Returns:
        always true.
      • slowlog

        RedisObject slowlog​(String subcommand,
                            String argument)

        From http://redis.io/commands/slowlog:

        Available since 2.2.12.

        This command is used in order to read and reset the Redis slow queries log.

        Parameters:
        subcommand - the slowlog subcommand.
        argument - the command argument.
        Returns:
        the object returned.
      • slowlogGet

        RedisObject slowlogGet​(long recentCount)

        From http://redis.io/commands/slowlog:

        Available since 2.2.12.

        This command is used in order to read and reset the Redis slow queries log.

        Parameters:
        recentCount - the amount of recent entries to view.
        Returns:
        the object returned.
      • time

        long[] time()

        From http://redis.io/commands/time:

        Available since 2.6.0.

        Time complexity: O(1)

        The TIME command returns the current server time as a two items lists: a Unix timestamp and the amount of microseconds already elapsed in the current second. Basically the interface is very similar to the one of the gettimeofday system call.

        Returns:
        UNIX time in seconds, microseconds.