org.springframework.data.redis.connection.ReactiveServerCommands Maven / Gradle / Ivy
/*
* Copyright 2017-2018 the original author or authors.
*
* Licensed 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 org.springframework.data.redis.connection;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.util.Properties;
import org.springframework.data.redis.core.types.RedisClientInfo;
/**
* Redis Server commands executed using reactive infrastructure.
*
* @author Mark Paluch
* @author Christoph Strobl
* @since 2.0
*/
public interface ReactiveServerCommands {
/**
* Start an {@literal Append Only File} rewrite process on server.
*
* @return {@link Mono} indicating command completion.
* @see Redis Documentation: BGREWRITEAOF
*/
Mono bgReWriteAof();
/**
* Start background saving of db on server.
*
* @return {@link Mono} indicating command received by server. Operation success needs to be checked via
* {@link #lastSave()}.
* @see Redis Documentation: BGSAVE
*/
Mono bgSave();
/**
* Get time unix timestamp of last successful {@link #bgSave()} operation in seconds.
*
* @return {@link Mono} wrapping unix timestamp.
* @see Redis Documentation: LASTSAVE
*/
Mono lastSave();
/**
* Synchronous save current db snapshot on server.
*
* @return {@link Mono} indicating command completion.
* @see Redis Documentation: SAVE
*/
Mono save();
/**
* Get the total number of available keys in currently selected database.
*
* @return {@link Mono} wrapping number of keys.
* @see Redis Documentation: DBSIZE
*/
Mono dbSize();
/**
* Delete all keys of the currently selected database.
*
* @return {@link Mono} indicating command completion.
* @see Redis Documentation: FLUSHDB
*/
Mono flushDb();
/**
* Delete all all keys from all databases.
*
* @return {@link Mono} indicating command completion.
* @see Redis Documentation: FLUSHALL
*/
Mono flushAll();
/**
* Load {@literal default} server information like
*
* - memory
* - cpu utilization
* - replication
*
*
*
* @return {@link Mono} wrapping server information.
* @see Redis Documentation: INFO
*/
Mono info();
/**
* Load server information for given {@code selection}.
*
* @param section must not be {@literal null} nor {@literal empty}.
* @return {@link Mono} wrapping server information of given {@code section}.
* @throws IllegalArgumentException when section is {@literal null} or {@literal empty}.
* @see Redis Documentation: INFO
*/
Mono info(String section);
/**
* Load configuration parameters for given {@code pattern} from server.
*
* @param pattern must not be {@literal null}.
* @return {@link Mono} wrapping configuration parameters matching given {@code pattern}.
* @throws IllegalArgumentException when {@code pattern} is {@literal null} or {@literal empty}.
* @see Redis Documentation: CONFIG GET
*/
Mono getConfig(String pattern);
/**
* Set server configuration for {@code param} to {@code value}.
*
* @param param must not be {@literal null} nor {@literal empty}.
* @param value must not be {@literal null} nor {@literal empty}.
* @throws IllegalArgumentException when {@code pattern} / {@code value} is {@literal null} or {@literal empty}.
* @see Redis Documentation: CONFIG SET
*/
Mono setConfig(String param, String value);
/**
* Reset statistic counters on server.
* Counters can be retrieved using {@link #info()}.
*
* @return {@link Mono} indicating command completion.
* @see Redis Documentation: CONFIG RESETSTAT
*/
Mono resetConfigStats();
/**
* Request server timestamp using {@code TIME} command.
*
* @return {@link Mono} wrapping current server time in milliseconds.
* @see Redis Documentation: TIME
*/
Mono time();
/**
* Closes a given client connection identified by {@literal host:port}.
*
* @param host of connection to close. Must not be {@literal null} nor {@literal empty}.
* @param port of connection to close
* @return {@link Mono} wrapping {@link String} representation of the command result.
* @throws IllegalArgumentException if {@code host} is {@literal null} or {@literal empty}.
* @see Redis Documentation: CLIENT KILL
*/
Mono killClient(String host, int port);
/**
* Assign given name to current connection.
*
* @param name must not be {@literal null} nor {@literal empty}.
* @throws IllegalArgumentException when {@code name} is {@literal null} or {@literal empty}.
* @see Redis Documentation: CLIENT SETNAME
*/
Mono setClientName(String name);
/**
* Returns the name of the current connection.
*
* @return {@link Mono} wrapping the connection name.
* @see Redis Documentation: CLIENT GETNAME
*/
Mono getClientName();
/**
* Request information and statistics about connected clients.
*
* @return {@link Flux} emitting {@link RedisClientInfo} objects.
* @see Redis Documentation: CLIENT LIST
*/
Flux getClientList();
}