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
7382262a
Commit
7382262a
authored
Mar 12, 2018
by
Nick Craver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup: KeyspaceIsolation
parent
67d53bd8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
DatabaseWrapper.cs
.../StackExchange/Redis/KeyspaceIsolation/DatabaseWrapper.cs
+9
-3
WrapperBase.cs
...edis/StackExchange/Redis/KeyspaceIsolation/WrapperBase.cs
+8
-4
No files found.
StackExchange.Redis/StackExchange/Redis/KeyspaceIsolation/DatabaseWrapper.cs
View file @
7382262a
...
@@ -36,6 +36,7 @@ public long GeoAdd(RedisKey key, GeoEntry[] values, CommandFlags flags = Command
...
@@ -36,6 +36,7 @@ public long GeoAdd(RedisKey key, GeoEntry[] values, CommandFlags flags = Command
{
{
return
Inner
.
GeoAdd
(
ToInner
(
key
),
values
,
flags
);
return
Inner
.
GeoAdd
(
ToInner
(
key
),
values
,
flags
);
}
}
public
bool
GeoAdd
(
RedisKey
key
,
GeoEntry
value
,
CommandFlags
flags
=
CommandFlags
.
None
)
public
bool
GeoAdd
(
RedisKey
key
,
GeoEntry
value
,
CommandFlags
flags
=
CommandFlags
.
None
)
{
{
return
Inner
.
GeoAdd
(
ToInner
(
key
),
value
,
flags
);
return
Inner
.
GeoAdd
(
ToInner
(
key
),
value
,
flags
);
...
@@ -75,6 +76,7 @@ public GeoRadiusResult[] GeoRadius(RedisKey key, RedisValue member, double radiu
...
@@ -75,6 +76,7 @@ public GeoRadiusResult[] GeoRadius(RedisKey key, RedisValue member, double radiu
{
{
return
Inner
.
GeoRadius
(
ToInner
(
key
),
member
,
radius
,
unit
,
count
,
order
,
options
,
flags
);
return
Inner
.
GeoRadius
(
ToInner
(
key
),
member
,
radius
,
unit
,
count
,
order
,
options
,
flags
);
}
}
public
GeoRadiusResult
[]
GeoRadius
(
RedisKey
key
,
double
longitude
,
double
latitude
,
double
radius
,
GeoUnit
unit
=
GeoUnit
.
Meters
,
int
count
=
-
1
,
Order
?
order
=
null
,
GeoRadiusOptions
options
=
GeoRadiusOptions
.
Default
,
CommandFlags
flags
=
CommandFlags
.
None
)
public
GeoRadiusResult
[]
GeoRadius
(
RedisKey
key
,
double
longitude
,
double
latitude
,
double
radius
,
GeoUnit
unit
=
GeoUnit
.
Meters
,
int
count
=
-
1
,
Order
?
order
=
null
,
GeoRadiusOptions
options
=
GeoRadiusOptions
.
Default
,
CommandFlags
flags
=
CommandFlags
.
None
)
{
{
return
Inner
.
GeoRadius
(
ToInner
(
key
),
longitude
,
latitude
,
radius
,
unit
,
count
,
order
,
options
,
flags
);
return
Inner
.
GeoRadius
(
ToInner
(
key
),
longitude
,
latitude
,
radius
,
unit
,
count
,
order
,
options
,
flags
);
...
@@ -365,7 +367,7 @@ public RedisResult Execute(string command, params object[] args)
...
@@ -365,7 +367,7 @@ public RedisResult Execute(string command, params object[] args)
public
RedisResult
Execute
(
string
command
,
ICollection
<
object
>
args
,
CommandFlags
flags
=
CommandFlags
.
None
)
public
RedisResult
Execute
(
string
command
,
ICollection
<
object
>
args
,
CommandFlags
flags
=
CommandFlags
.
None
)
=>
Inner
.
Execute
(
command
,
ToInner
(
args
),
flags
);
=>
Inner
.
Execute
(
command
,
ToInner
(
args
),
flags
);
public
RedisResult
ScriptEvaluate
(
byte
[]
hash
,
RedisKey
[]
keys
=
null
,
RedisValue
[]
values
=
null
,
CommandFlags
flags
=
CommandFlags
.
None
)
public
RedisResult
ScriptEvaluate
(
byte
[]
hash
,
RedisKey
[]
keys
=
null
,
RedisValue
[]
values
=
null
,
CommandFlags
flags
=
CommandFlags
.
None
)
{
{
// TODO: The return value could contain prefixed keys. It might make sense to 'unprefix' those?
// TODO: The return value could contain prefixed keys. It might make sense to 'unprefix' those?
...
@@ -474,10 +476,12 @@ public RedisValue[] Sort(RedisKey key, long skip = 0, long take = -1, Order orde
...
@@ -474,10 +476,12 @@ public RedisValue[] Sort(RedisKey key, long skip = 0, long take = -1, Order orde
{
{
return
Inner
.
Sort
(
ToInner
(
key
),
skip
,
take
,
order
,
sortType
,
SortByToInner
(
by
),
SortGetToInner
(
get
),
flags
);
return
Inner
.
Sort
(
ToInner
(
key
),
skip
,
take
,
order
,
sortType
,
SortByToInner
(
by
),
SortGetToInner
(
get
),
flags
);
}
}
public
long
SortedSetAdd
(
RedisKey
key
,
SortedSetEntry
[]
values
,
CommandFlags
flags
)
public
long
SortedSetAdd
(
RedisKey
key
,
SortedSetEntry
[]
values
,
CommandFlags
flags
)
{
{
return
Inner
.
SortedSetAdd
(
ToInner
(
key
),
values
,
flags
);
return
Inner
.
SortedSetAdd
(
ToInner
(
key
),
values
,
flags
);
}
}
public
long
SortedSetAdd
(
RedisKey
key
,
SortedSetEntry
[]
values
,
When
when
=
When
.
Always
,
CommandFlags
flags
=
CommandFlags
.
None
)
public
long
SortedSetAdd
(
RedisKey
key
,
SortedSetEntry
[]
values
,
When
when
=
When
.
Always
,
CommandFlags
flags
=
CommandFlags
.
None
)
{
{
return
Inner
.
SortedSetAdd
(
ToInner
(
key
),
values
,
when
,
flags
);
return
Inner
.
SortedSetAdd
(
ToInner
(
key
),
values
,
when
,
flags
);
...
@@ -487,6 +491,7 @@ public bool SortedSetAdd(RedisKey key, RedisValue member, double score, CommandF
...
@@ -487,6 +491,7 @@ public bool SortedSetAdd(RedisKey key, RedisValue member, double score, CommandF
{
{
return
Inner
.
SortedSetAdd
(
ToInner
(
key
),
member
,
score
,
flags
);
return
Inner
.
SortedSetAdd
(
ToInner
(
key
),
member
,
score
,
flags
);
}
}
public
bool
SortedSetAdd
(
RedisKey
key
,
RedisValue
member
,
double
score
,
When
when
=
When
.
Always
,
CommandFlags
flags
=
CommandFlags
.
None
)
public
bool
SortedSetAdd
(
RedisKey
key
,
RedisValue
member
,
double
score
,
When
when
=
When
.
Always
,
CommandFlags
flags
=
CommandFlags
.
None
)
{
{
return
Inner
.
SortedSetAdd
(
ToInner
(
key
),
member
,
score
,
when
,
flags
);
return
Inner
.
SortedSetAdd
(
ToInner
(
key
),
member
,
score
,
when
,
flags
);
...
@@ -687,11 +692,11 @@ public TimeSpan Ping(CommandFlags flags = CommandFlags.None)
...
@@ -687,11 +692,11 @@ public TimeSpan Ping(CommandFlags flags = CommandFlags.None)
return
Inner
.
Ping
(
flags
);
return
Inner
.
Ping
(
flags
);
}
}
IEnumerable
<
HashEntry
>
IDatabase
.
HashScan
(
RedisKey
key
,
RedisValue
pattern
,
int
pageSize
,
CommandFlags
flags
)
IEnumerable
<
HashEntry
>
IDatabase
.
HashScan
(
RedisKey
key
,
RedisValue
pattern
,
int
pageSize
,
CommandFlags
flags
)
{
{
return
HashScan
(
key
,
pattern
,
pageSize
,
RedisBase
.
CursorUtils
.
Origin
,
0
,
flags
);
return
HashScan
(
key
,
pattern
,
pageSize
,
RedisBase
.
CursorUtils
.
Origin
,
0
,
flags
);
}
}
public
IEnumerable
<
HashEntry
>
HashScan
(
RedisKey
key
,
RedisValue
pattern
=
default
(
RedisValue
),
int
pageSize
=
RedisBase
.
CursorUtils
.
DefaultPageSize
,
long
cursor
=
RedisBase
.
CursorUtils
.
Origin
,
int
pageOffset
=
0
,
CommandFlags
flags
=
CommandFlags
.
None
)
public
IEnumerable
<
HashEntry
>
HashScan
(
RedisKey
key
,
RedisValue
pattern
=
default
(
RedisValue
),
int
pageSize
=
RedisBase
.
CursorUtils
.
DefaultPageSize
,
long
cursor
=
RedisBase
.
CursorUtils
.
Origin
,
int
pageOffset
=
0
,
CommandFlags
flags
=
CommandFlags
.
None
)
{
{
return
Inner
.
HashScan
(
ToInner
(
key
),
pattern
,
pageSize
,
cursor
,
pageOffset
,
flags
);
return
Inner
.
HashScan
(
ToInner
(
key
),
pattern
,
pageSize
,
cursor
,
pageOffset
,
flags
);
...
@@ -701,6 +706,7 @@ IEnumerable<RedisValue> IDatabase.SetScan(RedisKey key, RedisValue pattern, int
...
@@ -701,6 +706,7 @@ IEnumerable<RedisValue> IDatabase.SetScan(RedisKey key, RedisValue pattern, int
{
{
return
SetScan
(
key
,
pattern
,
pageSize
,
RedisBase
.
CursorUtils
.
Origin
,
0
,
flags
);
return
SetScan
(
key
,
pattern
,
pageSize
,
RedisBase
.
CursorUtils
.
Origin
,
0
,
flags
);
}
}
public
IEnumerable
<
RedisValue
>
SetScan
(
RedisKey
key
,
RedisValue
pattern
=
default
(
RedisValue
),
int
pageSize
=
RedisBase
.
CursorUtils
.
DefaultPageSize
,
long
cursor
=
RedisBase
.
CursorUtils
.
Origin
,
int
pageOffset
=
0
,
CommandFlags
flags
=
CommandFlags
.
None
)
public
IEnumerable
<
RedisValue
>
SetScan
(
RedisKey
key
,
RedisValue
pattern
=
default
(
RedisValue
),
int
pageSize
=
RedisBase
.
CursorUtils
.
DefaultPageSize
,
long
cursor
=
RedisBase
.
CursorUtils
.
Origin
,
int
pageOffset
=
0
,
CommandFlags
flags
=
CommandFlags
.
None
)
{
{
return
Inner
.
SetScan
(
ToInner
(
key
),
pattern
,
pageSize
,
cursor
,
pageOffset
,
flags
);
return
Inner
.
SetScan
(
ToInner
(
key
),
pattern
,
pageSize
,
cursor
,
pageOffset
,
flags
);
...
@@ -710,12 +716,12 @@ IEnumerable<SortedSetEntry> IDatabase.SortedSetScan(RedisKey key, RedisValue pat
...
@@ -710,12 +716,12 @@ IEnumerable<SortedSetEntry> IDatabase.SortedSetScan(RedisKey key, RedisValue pat
{
{
return
SortedSetScan
(
key
,
pattern
,
pageSize
,
RedisBase
.
CursorUtils
.
Origin
,
0
,
flags
);
return
SortedSetScan
(
key
,
pattern
,
pageSize
,
RedisBase
.
CursorUtils
.
Origin
,
0
,
flags
);
}
}
public
IEnumerable
<
SortedSetEntry
>
SortedSetScan
(
RedisKey
key
,
RedisValue
pattern
=
default
(
RedisValue
),
int
pageSize
=
RedisBase
.
CursorUtils
.
DefaultPageSize
,
long
cursor
=
RedisBase
.
CursorUtils
.
Origin
,
int
pageOffset
=
0
,
CommandFlags
flags
=
CommandFlags
.
None
)
public
IEnumerable
<
SortedSetEntry
>
SortedSetScan
(
RedisKey
key
,
RedisValue
pattern
=
default
(
RedisValue
),
int
pageSize
=
RedisBase
.
CursorUtils
.
DefaultPageSize
,
long
cursor
=
RedisBase
.
CursorUtils
.
Origin
,
int
pageOffset
=
0
,
CommandFlags
flags
=
CommandFlags
.
None
)
{
{
return
Inner
.
SortedSetScan
(
ToInner
(
key
),
pattern
,
pageSize
,
cursor
,
pageOffset
,
flags
);
return
Inner
.
SortedSetScan
(
ToInner
(
key
),
pattern
,
pageSize
,
cursor
,
pageOffset
,
flags
);
}
}
#if DEBUG
#if DEBUG
public
string
ClientGetName
(
CommandFlags
flags
=
CommandFlags
.
None
)
public
string
ClientGetName
(
CommandFlags
flags
=
CommandFlags
.
None
)
{
{
...
...
StackExchange.Redis/StackExchange/Redis/KeyspaceIsolation/WrapperBase.cs
View file @
7382262a
...
@@ -46,7 +46,6 @@ public Task<string[]> GeoHashAsync(RedisKey key, RedisValue[] members, CommandFl
...
@@ -46,7 +46,6 @@ public Task<string[]> GeoHashAsync(RedisKey key, RedisValue[] members, CommandFl
public
Task
<
string
>
GeoHashAsync
(
RedisKey
key
,
RedisValue
member
,
CommandFlags
flags
=
CommandFlags
.
None
)
public
Task
<
string
>
GeoHashAsync
(
RedisKey
key
,
RedisValue
member
,
CommandFlags
flags
=
CommandFlags
.
None
)
=>
Inner
.
GeoHashAsync
(
ToInner
(
key
),
member
,
flags
);
=>
Inner
.
GeoHashAsync
(
ToInner
(
key
),
member
,
flags
);
public
Task
<
GeoPosition
?[
]>
GeoPositionAsync
(
RedisKey
key
,
RedisValue
[]
members
,
CommandFlags
flags
=
CommandFlags
.
None
)
public
Task
<
GeoPosition
?[
]>
GeoPositionAsync
(
RedisKey
key
,
RedisValue
[]
members
,
CommandFlags
flags
=
CommandFlags
.
None
)
=>
Inner
.
GeoPositionAsync
(
ToInner
(
key
),
members
,
flags
);
=>
Inner
.
GeoPositionAsync
(
ToInner
(
key
),
members
,
flags
);
...
@@ -59,7 +58,6 @@ public Task<GeoRadiusResult[]> GeoRadiusAsync(RedisKey key, RedisValue member, d
...
@@ -59,7 +58,6 @@ public Task<GeoRadiusResult[]> GeoRadiusAsync(RedisKey key, RedisValue member, d
public
Task
<
GeoRadiusResult
[
]>
GeoRadiusAsync
(
RedisKey
key
,
double
longitude
,
double
latitude
,
double
radius
,
GeoUnit
unit
=
GeoUnit
.
Meters
,
int
count
=
-
1
,
Order
?
order
=
null
,
GeoRadiusOptions
options
=
GeoRadiusOptions
.
Default
,
CommandFlags
flags
=
CommandFlags
.
None
)
public
Task
<
GeoRadiusResult
[
]>
GeoRadiusAsync
(
RedisKey
key
,
double
longitude
,
double
latitude
,
double
radius
,
GeoUnit
unit
=
GeoUnit
.
Meters
,
int
count
=
-
1
,
Order
?
order
=
null
,
GeoRadiusOptions
options
=
GeoRadiusOptions
.
Default
,
CommandFlags
flags
=
CommandFlags
.
None
)
=>
Inner
.
GeoRadiusAsync
(
ToInner
(
key
),
longitude
,
latitude
,
radius
,
unit
,
count
,
order
,
options
,
flags
);
=>
Inner
.
GeoRadiusAsync
(
ToInner
(
key
),
longitude
,
latitude
,
radius
,
unit
,
count
,
order
,
options
,
flags
);
public
Task
<
double
>
HashDecrementAsync
(
RedisKey
key
,
RedisValue
hashField
,
double
value
,
CommandFlags
flags
=
CommandFlags
.
None
)
public
Task
<
double
>
HashDecrementAsync
(
RedisKey
key
,
RedisValue
hashField
,
double
value
,
CommandFlags
flags
=
CommandFlags
.
None
)
{
{
return
Inner
.
HashDecrementAsync
(
ToInner
(
key
),
hashField
,
value
,
flags
);
return
Inner
.
HashDecrementAsync
(
ToInner
(
key
),
hashField
,
value
,
flags
);
...
@@ -344,8 +342,10 @@ public Task<long> PublishAsync(RedisChannel channel, RedisValue message, Command
...
@@ -344,8 +342,10 @@ public Task<long> PublishAsync(RedisChannel channel, RedisValue message, Command
{
{
return
Inner
.
PublishAsync
(
ToInner
(
channel
),
message
,
flags
);
return
Inner
.
PublishAsync
(
ToInner
(
channel
),
message
,
flags
);
}
}
public
Task
<
RedisResult
>
ExecuteAsync
(
string
command
,
params
object
[]
args
)
public
Task
<
RedisResult
>
ExecuteAsync
(
string
command
,
params
object
[]
args
)
=>
Inner
.
ExecuteAsync
(
command
,
ToInner
(
args
),
CommandFlags
.
None
);
=>
Inner
.
ExecuteAsync
(
command
,
ToInner
(
args
),
CommandFlags
.
None
);
public
Task
<
RedisResult
>
ExecuteAsync
(
string
command
,
ICollection
<
object
>
args
,
CommandFlags
flags
=
CommandFlags
.
None
)
public
Task
<
RedisResult
>
ExecuteAsync
(
string
command
,
ICollection
<
object
>
args
,
CommandFlags
flags
=
CommandFlags
.
None
)
=>
Inner
.
ExecuteAsync
(
command
,
ToInner
(
args
),
flags
);
=>
Inner
.
ExecuteAsync
(
command
,
ToInner
(
args
),
flags
);
...
@@ -460,6 +460,7 @@ public Task<long> SortedSetAddAsync(RedisKey key, SortedSetEntry[] values, Comma
...
@@ -460,6 +460,7 @@ public Task<long> SortedSetAddAsync(RedisKey key, SortedSetEntry[] values, Comma
{
{
return
Inner
.
SortedSetAddAsync
(
ToInner
(
key
),
values
,
flags
);
return
Inner
.
SortedSetAddAsync
(
ToInner
(
key
),
values
,
flags
);
}
}
public
Task
<
long
>
SortedSetAddAsync
(
RedisKey
key
,
SortedSetEntry
[]
values
,
When
when
=
When
.
Always
,
CommandFlags
flags
=
CommandFlags
.
None
)
public
Task
<
long
>
SortedSetAddAsync
(
RedisKey
key
,
SortedSetEntry
[]
values
,
When
when
=
When
.
Always
,
CommandFlags
flags
=
CommandFlags
.
None
)
{
{
return
Inner
.
SortedSetAddAsync
(
ToInner
(
key
),
values
,
when
,
flags
);
return
Inner
.
SortedSetAddAsync
(
ToInner
(
key
),
values
,
when
,
flags
);
...
@@ -469,6 +470,7 @@ public Task<bool> SortedSetAddAsync(RedisKey key, RedisValue member, double scor
...
@@ -469,6 +470,7 @@ public Task<bool> SortedSetAddAsync(RedisKey key, RedisValue member, double scor
{
{
return
Inner
.
SortedSetAddAsync
(
ToInner
(
key
),
member
,
score
,
flags
);
return
Inner
.
SortedSetAddAsync
(
ToInner
(
key
),
member
,
score
,
flags
);
}
}
public
Task
<
bool
>
SortedSetAddAsync
(
RedisKey
key
,
RedisValue
member
,
double
score
,
When
when
=
When
.
Always
,
CommandFlags
flags
=
CommandFlags
.
None
)
public
Task
<
bool
>
SortedSetAddAsync
(
RedisKey
key
,
RedisValue
member
,
double
score
,
When
when
=
When
.
Always
,
CommandFlags
flags
=
CommandFlags
.
None
)
{
{
return
Inner
.
SortedSetAddAsync
(
ToInner
(
key
),
member
,
score
,
when
,
flags
);
return
Inner
.
SortedSetAddAsync
(
ToInner
(
key
),
member
,
score
,
when
,
flags
);
...
@@ -712,9 +714,10 @@ protected RedisKey ToInnerOrDefault(RedisKey outer)
...
@@ -712,9 +714,10 @@ protected RedisKey ToInnerOrDefault(RedisKey outer)
return
ToInner
(
outer
);
return
ToInner
(
outer
);
}
}
}
}
protected
ICollection
<
object
>
ToInner
(
ICollection
<
object
>
args
)
protected
ICollection
<
object
>
ToInner
(
ICollection
<
object
>
args
)
{
{
if
(
args
!=
null
&&
args
.
Any
(
x
=>
x
is
RedisKey
||
x
is
RedisChannel
)
)
if
(
args
?.
Any
(
x
=>
x
is
RedisKey
||
x
is
RedisChannel
)
==
true
)
{
{
var
withPrefix
=
new
object
[
args
.
Count
];
var
withPrefix
=
new
object
[
args
.
Count
];
int
i
=
0
;
int
i
=
0
;
...
@@ -739,6 +742,7 @@ protected ICollection<object> ToInner(ICollection<object> args)
...
@@ -739,6 +742,7 @@ protected ICollection<object> ToInner(ICollection<object> args)
}
}
return
args
;
return
args
;
}
}
protected
RedisKey
[]
ToInner
(
RedisKey
[]
outer
)
protected
RedisKey
[]
ToInner
(
RedisKey
[]
outer
)
{
{
if
(
outer
==
null
||
outer
.
Length
==
0
)
if
(
outer
==
null
||
outer
.
Length
==
0
)
...
@@ -839,7 +843,7 @@ protected RedisChannel ToInner(RedisChannel outer)
...
@@ -839,7 +843,7 @@ protected RedisChannel ToInner(RedisChannel outer)
protected
Func
<
RedisKey
,
RedisKey
>
GetMapFunction
()
protected
Func
<
RedisKey
,
RedisKey
>
GetMapFunction
()
{
{
// create as a delegate when first required, then re-use
// create as a delegate when first required, then re-use
return
mapFunction
??
(
mapFunction
=
new
Func
<
RedisKey
,
RedisKey
>(
ToInner
));
return
mapFunction
??
(
mapFunction
=
new
Func
<
RedisKey
,
RedisKey
>(
ToInner
));
}
}
}
}
}
}
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