Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 1373bae

Browse files
committed
Capture ServerVersionNumber to use enhanced redis-server operations where available
1 parent 0019dce commit 1373bae

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/ServiceStack.Redis/RedisNativeClient_Utils.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public partial class RedisNativeClient
2626
{
2727
private static Timer UsageTimer;
2828
private static int __requestsPerHour = 0;
29+
public int ServerVersionNumber { get; set; }
2930

3031
public static void DisposeTimers()
3132
{
@@ -84,6 +85,15 @@ private void Connect()
8485

8586
if (db != 0)
8687
SendExpectSuccess(Commands.Select, db.ToUtf8Bytes());
88+
89+
try
90+
{
91+
if (ServerVersionNumber == 0)
92+
{
93+
ServerVersionNumber = int.Parse(ServerVersion.Replace(".", "").PadRight(4, '0'));
94+
}
95+
}
96+
catch {}
8797

8898
var ipEndpoint = socket.LocalEndPoint as IPEndPoint;
8999
clientPort = ipEndpoint != null ? ipEndpoint.Port : -1;

0 commit comments

Comments
 (0)