Class TrackingArgs

    • Constructor Detail

      • TrackingArgs

        public TrackingArgs()
    • Method Detail

      • enabled

        public TrackingArgs enabled​(boolean 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:
        this TrackingArgs.
      • redirect

        public TrackingArgs redirect​(long clientId)
        Send redirection messages to the connection with the specified ID. The connection must exist, you can get the ID of such connection using CLIENT 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:
        this TrackingArgs.
      • bcast

        public TrackingArgs 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:
        this TrackingArgs.
      • prefixes

        public TrackingArgs prefixes​(String... 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 using StandardCharsets.UTF_8.
        Returns:
        this TrackingArgs.
      • prefixes

        public TrackingArgs prefixes​(Charset charset,
                                     String... 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 for prefixes encoding.
        prefixes - the key prefixes for broadcasting of change notifications.
        Returns:
        this TrackingArgs.
      • optin

        public TrackingArgs 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:
        this TrackingArgs.
      • optout

        public TrackingArgs 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:
        this TrackingArgs.
      • noloop

        public TrackingArgs noloop()
        Don't send notifications about keys modified by this connection itself.
        Returns:
        this TrackingArgs.
      • build

        public <K,​V> void build​(CommandArgs<K,​V> args)
        Description copied from interface: CompositeArgument
        Build command arguments and contribute arguments to CommandArgs.

        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:
        build in interface CompositeArgument
        Type Parameters:
        K - Key type.
        V - Value type.
        Parameters:
        args - the command arguments, must not be null.