Class RedisClusterNode

    • Method Detail

      • setUri

        public void setUri​(RedisURI uri)
        Sets the connection point details. Usually the host/ip/port where a particular Redis Cluster node server is running.
        Parameters:
        uri - the RedisURI, must not be null
      • getNodeId

        public String getNodeId()
      • setNodeId

        public void setNodeId​(String nodeId)
        Sets nodeId.
        Parameters:
        nodeId - the nodeId
      • isConnected

        public boolean isConnected()
      • setConnected

        public void setConnected​(boolean connected)
        Sets the connected flag. The connected flag describes whether the node which provided details about the node is connected to the particular RedisClusterNode.
        Parameters:
        connected - the connected flag
      • getSlaveOf

        public String getSlaveOf()
      • setSlaveOf

        public void setSlaveOf​(String slaveOf)
        Sets the replication source.
        Parameters:
        slaveOf - the replication source, can be null
      • getPingSentTimestamp

        public long getPingSentTimestamp()
      • setPingSentTimestamp

        public void setPingSentTimestamp​(long pingSentTimestamp)
        Sets the last pingSentTimestamp.
        Parameters:
        pingSentTimestamp - the last pingSentTimestamp
      • getPongReceivedTimestamp

        public long getPongReceivedTimestamp()
      • setPongReceivedTimestamp

        public void setPongReceivedTimestamp​(long pongReceivedTimestamp)
        Sets the last pongReceivedTimestamp.
        Parameters:
        pongReceivedTimestamp - the last pongReceivedTimestamp
      • getConfigEpoch

        public long getConfigEpoch()
      • setConfigEpoch

        public void setConfigEpoch​(long configEpoch)
        Sets the configEpoch.
        Parameters:
        configEpoch - the configEpoch
      • getReplOffset

        public long getReplOffset()
      • setReplOffset

        public void setReplOffset​(long replOffset)
        Sets the replOffset. Typically, obtained from INFO REPLICATION master_repl_offset. Can be -1 in case it was not obtained from Redis or set in the data model.
        Parameters:
        replOffset - the replOffset
      • getSlots

        public List<Integer> getSlots()
        Return the slots as List. Note that this method creates a new List for each time it gets called.
        Returns:
        the slots as List.
      • forEachSlot

        public void forEachSlot​(IntConsumer consumer)
        Performs the given action for each slot of this RedisClusterNode until all elements have been processed or the action throws an exception. Unless otherwise specified by the implementing class, actions are performed in the order of iteration (if an iteration order is specified). Exceptions thrown by the action are relayed to the caller.
        Parameters:
        consumer -
        Since:
        5.2
      • setSlots

        public void setSlots​(List<Integer> slots)
        Sets the list of slots for which this RedisClusterNode is the RedisClusterNode.NodeFlag.UPSTREAM. The list is empty if this node is not a upstream or the node is not responsible for any slots at all.
        Parameters:
        slots - list of slots, must not be null but may be empty
      • hasSameSlotsAs

        public boolean hasSameSlotsAs​(RedisClusterNode other)
        Return true if the other node contains the same slots as this node.
        Parameters:
        other - the node to compare with.
        Returns:
        true if the other node contains the same slots as this node.
      • addAlias

        public void addAlias​(RedisURI alias)
        Add an alias to RedisClusterNode.
        Parameters:
        alias - must not be null.
      • hasSlot

        public boolean hasSlot​(int slot)
        Parameters:
        slot - the slot hash
        Returns:
        true if the slot is contained within the handled slots.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object