java.lang.Object
io.lettuce.core.TrackingArgs
- All Implemented Interfaces:
CompositeArgument
public class TrackingArgs extends Object implements CompositeArgument
Argument list builder for the Redis CLIENT TRACKING command. Static
import the methods from
TrackingArgs.Builder and chain the method calls: enabled().bcast().
TrackingArgs is a mutable object and instances should be used only once to avoid shared mutable state.
- Since:
- 6.0
- Author:
- Mark Paluch
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTrackingArgs.BuilderBuilder entry points forTrackingArgs. -
Constructor Summary
Constructors Constructor Description TrackingArgs() -
Method Summary
Modifier and Type Method Description TrackingArgsbcast()Enable tracking in broadcasting mode.<K, V> voidbuild(CommandArgs<K,V> args)Build command arguments and contribute arguments toCommandArgs.TrackingArgsenabled(boolean enabled)Controls whether to enable key tracking for the currently connected client.TrackingArgsnoloop()Don't send notifications about keys modified by this connection itself.TrackingArgsoptin()When broadcasting is NOT active, normally don't track keys in read only commands, unless they are called immediately after a CLIENT CACHING yes command.TrackingArgsoptout()When broadcasting is NOT active, normally track keys in read only commands, unless they are called immediately after a CLIENT CACHING no command.TrackingArgsprefixes(String... prefixes)For broadcasting, register a given key prefix, so that notifications will be provided only for keys starting with this string.TrackingArgsprefixes(Charset charset, String... prefixes)For broadcasting, register a given key prefix, so that notifications will be provided only for keys starting with this string.TrackingArgsredirect(long clientId)Send redirection messages to the connection with the specified ID.
-
Constructor Details
-
TrackingArgs
public TrackingArgs()
-
-
Method Details
-
enabled
Controls whether to enable key tracking for the currently connected client.- Parameters:
enabled- whether to enable key tracking for the currently connected client.- Returns:
thisTrackingArgs.
-
redirect
Send redirection messages to the connection with the specified ID. The connection must exist, you can get the ID of such connection usingCLIENT ID. If the connection we are redirecting to is terminated, when in RESP3 mode the connection with tracking enabled will receive tracking-redir-broken push messages in order to signal the condition.- Parameters:
clientId- process Id of the client for notification redirection.- Returns:
thisTrackingArgs.
-
bcast
Enable tracking in broadcasting mode. In this mode invalidation messages are reported for all the prefixes specified, regardless of the keys requested by the connection. Instead when the broadcasting mode is not enabled, Redis will track which keys are fetched using read-only commands, and will report invalidation messages only for such keys.- Returns:
thisTrackingArgs.
-
prefixes
For broadcasting, register a given key prefix, so that notifications will be provided only for keys starting with this string. This option can be given multiple times to register multiple prefixes. If broadcasting is enabled without this option, Redis will send notifications for every key.- Parameters:
prefixes- the key prefixes for broadcasting of change notifications. Encoded usingStandardCharsets.UTF_8.- Returns:
thisTrackingArgs.
-
prefixes
For broadcasting, register a given key prefix, so that notifications will be provided only for keys starting with this string. This option can be given multiple times to register multiple prefixes. If broadcasting is enabled without this option, Redis will send notifications for every key.- Parameters:
charset- the charset to use forprefixesencoding.prefixes- the key prefixes for broadcasting of change notifications.- Returns:
thisTrackingArgs.
-
optin
When broadcasting is NOT active, normally don't track keys in read only commands, unless they are called immediately after a CLIENT CACHING yes command.- Returns:
thisTrackingArgs.
-
optout
When broadcasting is NOT active, normally track keys in read only commands, unless they are called immediately after a CLIENT CACHING no command.- Returns:
thisTrackingArgs.
-
noloop
Don't send notifications about keys modified by this connection itself.- Returns:
thisTrackingArgs.
-
build
Description copied from interface:CompositeArgumentBuild command arguments and contribute arguments toCommandArgs.Implementing classes are required to implement this method. Depending on the command nature and configured arguments, this method may contribute arguments but is not required to add arguments if none are specified.
- Specified by:
buildin interfaceCompositeArgument- Type Parameters:
K- Key type.V- Value type.- Parameters:
args- the command arguments, must not benull.
-