tidwall / redcon

Redis compatible server framework for Go
MIT License
2.16k stars 159 forks source link

is it possible to support close idle connection? #34

Closed pirDOL closed 3 years ago

pirDOL commented 3 years ago

Long connection is always used for client-side to optimize latency. Is it possible to support close idle connection on server-side(redcon) to avoid too many idle connections?

tidwall commented 3 years ago

There's nothing built in that supports auto closing idle connections.

tidwall commented 3 years ago

I just pushed this feature. For example:

s := redcon.NewServer(...)
s.SetIdleClose(time.Minute*5)
s.ListenAndServe()