All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.avsystem.commons.redis.NodeAddress.scala Maven / Gradle / Ivy

package com.avsystem.commons
package redis

import java.net.InetSocketAddress

object NodeAddress {
  final val DefaultIP = "127.0.0.1"
  final val DefaultPort = 6379
  final val DefaultSentinelPort = 26379

  final val Default = NodeAddress()
  final val DefaultSentinel = NodeAddress(port = DefaultSentinelPort)

  def parse(str: String): NodeAddress = {
    val Array(ip, port) = str.split(':')
    NodeAddress(ip, port.toInt)
  }
}
final case class NodeAddress(ip: String = NodeAddress.DefaultIP, port: Int = NodeAddress.DefaultPort) {
  def socketAddress = new InetSocketAddress(ip, port)
  override def toString = s"$ip:$port"
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy