diff --git a/src/main/java/redis/clients/jedis/commands/ControlBinaryCommands.java b/src/main/java/redis/clients/jedis/commands/ControlBinaryCommands.java index a5389139d2..b5d3e1797f 100644 --- a/src/main/java/redis/clients/jedis/commands/ControlBinaryCommands.java +++ b/src/main/java/redis/clients/jedis/commands/ControlBinaryCommands.java @@ -2,24 +2,95 @@ import java.util.List; +/** + * The interface about Redis management command + */ public interface ControlBinaryCommands extends AccessControlLogBinaryCommands, ClientBinaryCommands { + /** + * Provide information on the role of a Redis instance in the context of replication, + * by returning if the instance is currently a master, slave, or sentinel. The command + * also returns additional information about the state of the replication + * (if the role is master or slave) or the list of monitored master names (if the role is sentinel). + * + * @return The information on the role of a Redis instance + */ List roleBinary(); + /** + * Returns the reference count of the stored at {@code key}. + * + * @param key The key in Redis server + * @return The reference count of the stored at {@code key} + */ Long objectRefcount(byte[] key); + /** + * Returns the internal encoding for the Redis object stored at {@code key}. + *

+ * See for details: OBJECT ENCODING key + * + * @param key The key in Redis server + * @return The number of references + */ byte[] objectEncoding(byte[] key); + /** + * Returns the time in seconds since the last access to the value stored at {@code key}. + * The command is only available when the maxmemory-policy configuration directive + * is not set to one of the LFU policies. + * + * @param key The key in Redis server + * @return The idle time in seconds + */ Long objectIdletime(byte[] key); + /** + * Returns the object subcommands and usages. + * + * @return object subcommands and usages + */ List objectHelpBinary(); + /** + * Returns the logarithmic access frequency counter of a Redis object stored at {@code key}. + *

+ * The command is only available when the maxmemory-policy configuration directive is + * set to one of the LFU policies. + * + * @param key The key in Redis server + * @return The counter's value + */ Long objectFreq(byte[] key); + /** + * Reports about different memory-related issues that the Redis server experiences, + * and advises about possible remedies. + */ byte[] memoryDoctorBinary(); + /** + * Reports the number of bytes that a key and its value require to be stored in RAM. + * The reported usage is the total of memory allocations for data and administrative + * overheads that a key its value require. + *

+ * See for details: MEMORY USAGE key + * + * @param key The key in Redis server + * @return The memory usage in bytes, or nil when the key does not exist + */ Long memoryUsage(byte[] key); + /** + * Reports the number of bytes that a key and its value require to be stored in RAM. + * The reported usage is the total of memory allocations for data and administrative + * overheads that a key its value require. + *

+ * See for details: MEMORY USAGE key SAMPLES count + * + * @param key The key in Redis server + * @return The memory usage in bytes, or nil when the key does not exist + */ Long memoryUsage(byte[] key, int samples); } diff --git a/src/main/java/redis/clients/jedis/commands/ControlCommands.java b/src/main/java/redis/clients/jedis/commands/ControlCommands.java index 3e64f6b5fe..d1928441c3 100644 --- a/src/main/java/redis/clients/jedis/commands/ControlCommands.java +++ b/src/main/java/redis/clients/jedis/commands/ControlCommands.java @@ -2,24 +2,95 @@ import java.util.List; +/** + * The interface about Redis management command + */ public interface ControlCommands extends AccessControlLogCommands, ClientCommands { + /** + * Provide information on the role of a Redis instance in the context of replication, + * by returning if the instance is currently a master, slave, or sentinel. The command + * also returns additional information about the state of the replication + * (if the role is master or slave) or the list of monitored master names (if the role is sentinel). + * + * @return The information on the role of a Redis instance + */ List role(); + /** + * Returns the reference count of the stored at {@code key}. + * + * @param key The key in Redis server + * @return The reference count of the stored at {@code key} + */ Long objectRefcount(String key); + /** + * Returns the internal encoding for the Redis object stored at {@code key}. + *

+ * See for details: OBJECT ENCODING key + * + * @param key The key in Redis server + * @return The number of references + */ String objectEncoding(String key); + /** + * Returns the time in seconds since the last access to the value stored at {@code key}. + * The command is only available when the maxmemory-policy configuration directive + * is not set to one of the LFU policies. + * + * @param key The key in Redis server + * @return The idle time in seconds + */ Long objectIdletime(String key); + /** + * Returns the object subcommands and usages. + * + * @return object subcommands and usages + */ List objectHelp(); + /** + * Returns the logarithmic access frequency counter of a Redis object stored at {@code key}. + *

+ * The command is only available when the maxmemory-policy configuration directive is + * set to one of the LFU policies. + * + * @param key The key in Redis server + * @return The counter's value + */ Long objectFreq(String key); + /** + * Reports about different memory-related issues that the Redis server experiences, + * and advises about possible remedies. + */ String memoryDoctor(); + /** + * Reports the number of bytes that a key and its value require to be stored in RAM. + * The reported usage is the total of memory allocations for data and administrative + * overheads that a key its value require. + *

+ * See for details: MEMORY USAGE key + * + * @param key The key in Redis server + * @return The memory usage in bytes, or {@code nil} when the key does not exist + */ Long memoryUsage(String key); + /** + * Reports the number of bytes that a key and its value require to be stored in RAM. + * The reported usage is the total of memory allocations for data and administrative + * overheads that a key its value require. + *

+ * See for details: MEMORY USAGE key SAMPLES count + * + * @param key The key in Redis server + * @return The memory usage in bytes, or {@code nil} when the key does not exist + */ Long memoryUsage(String key, int samples); }