This commit is contained in:
2025-05-24 06:56:02 +04:00
parent 55a05a5571
commit b8c8da9e31
11 changed files with 517 additions and 119 deletions

View File

@@ -1,6 +1,7 @@
package redisserver
import (
"strconv"
"sync"
"time"
)
@@ -20,7 +21,7 @@ type Server struct {
}
type ServerConfig struct {
TCPPort string
TCPPort int
UnixSocketPath string
}
@@ -38,8 +39,8 @@ func NewServer(config ServerConfig) *Server {
go s.cleanupExpiredKeys()
// Start TCP server if port is provided
if config.TCPPort != "" {
tcpAddr := ":" + config.TCPPort
if config.TCPPort != 0 {
tcpAddr := ":" + strconv.Itoa(config.TCPPort)
go s.startRedisServer(tcpAddr, "")
}