Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
0be88ee3
Commit
0be88ee3
authored
Mar 12, 2018
by
Nick Craver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup: ServerSelectionStrategery
parent
0acb02ab
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
ServerSelectionStrategy.cs
...ange.Redis/StackExchange/Redis/ServerSelectionStrategy.cs
+5
-7
No files found.
StackExchange.Redis/StackExchange/Redis/ServerSelectionStrategy.cs
View file @
0be88ee3
...
...
@@ -49,14 +49,12 @@ internal sealed class ServerSelectionStrategy
private
ServerEndPoint
[]
map
;
private
ServerType
serverType
=
ServerType
.
Standalone
;
public
ServerSelectionStrategy
(
ConnectionMultiplexer
multiplexer
)
{
this
.
multiplexer
=
multiplexer
;
}
public
ServerType
ServerType
{
get
{
return
serverType
;
}
set
{
serverType
=
value
;
}
}
public
ServerType
ServerType
{
get
;
set
;
}
=
ServerType
.
Standalone
;
internal
int
TotalSlots
=>
RedisClusterSlotCount
;
/// <summary>
...
...
@@ -93,7 +91,7 @@ public ServerEndPoint Select(Message message)
{
if
(
message
==
null
)
throw
new
ArgumentNullException
(
nameof
(
message
));
int
slot
=
NoSlot
;
switch
(
s
erverType
)
switch
(
S
erverType
)
{
case
ServerType
.
Cluster
:
case
ServerType
.
Twemproxy
:
// strictly speaking twemproxy uses a different hashing algo, but the hash-tag behavior is
...
...
@@ -108,7 +106,7 @@ public ServerEndPoint Select(Message message)
public
ServerEndPoint
Select
(
int
db
,
RedisCommand
command
,
RedisKey
key
,
CommandFlags
flags
)
{
int
slot
=
s
erverType
==
ServerType
.
Cluster
?
HashSlot
(
key
)
:
NoSlot
;
int
slot
=
S
erverType
==
ServerType
.
Cluster
?
HashSlot
(
key
)
:
NoSlot
;
return
Select
(
slot
,
command
,
flags
);
}
...
...
@@ -116,7 +114,7 @@ public bool TryResend(int hashSlot, Message message, EndPoint endpoint, bool isM
{
try
{
if
(
s
erverType
==
ServerType
.
Standalone
||
hashSlot
<
0
||
hashSlot
>=
RedisClusterSlotCount
)
return
false
;
if
(
S
erverType
==
ServerType
.
Standalone
||
hashSlot
<
0
||
hashSlot
>=
RedisClusterSlotCount
)
return
false
;
ServerEndPoint
server
=
multiplexer
.
GetServerEndPoint
(
endpoint
);
if
(
server
!=
null
)
...
...
@@ -222,7 +220,7 @@ private static unsafe int IndexOf(byte* ptr, byte value, int start, int end)
private
ServerEndPoint
Any
(
RedisCommand
command
,
CommandFlags
flags
)
{
return
multiplexer
.
AnyConnected
(
s
erverType
,
(
uint
)
Interlocked
.
Increment
(
ref
anyStartOffset
),
command
,
flags
);
return
multiplexer
.
AnyConnected
(
S
erverType
,
(
uint
)
Interlocked
.
Increment
(
ref
anyStartOffset
),
command
,
flags
);
}
private
ServerEndPoint
FindMaster
(
ServerEndPoint
endpoint
,
RedisCommand
command
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment