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
dccca67c
Commit
dccca67c
authored
Jul 06, 2018
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SetUnion / SetDelete : don't recreate the data if it exists and looks viable
parent
74b1ce0a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
14 deletions
+24
-14
Issue182.cs
StackExchange.Redis.Tests/Issues/Issue182.cs
+24
-14
No files found.
StackExchange.Redis.Tests/Issues/Issue182.cs
View file @
dccca67c
...
@@ -27,13 +27,16 @@ public async Task SetMembers()
...
@@ -27,13 +27,16 @@ public async Task SetMembers()
var
key
=
Me
();
var
key
=
Me
();
const
int
count
=
(
int
)
5
e6
;
const
int
count
=
(
int
)
5
e6
;
var
len
=
await
db
.
SetLengthAsync
(
key
);
conn
.
Wait
(
db
.
KeyDeleteAsync
(
key
));
if
(
len
!=
count
)
foreach
(
var
_
in
Enumerable
.
Range
(
0
,
count
))
{
db
.
SetAdd
(
key
,
Guid
.
NewGuid
().
ToByteArray
(),
CommandFlags
.
FireAndForget
);
await
db
.
KeyDeleteAsync
(
key
);
foreach
(
var
_
in
Enumerable
.
Range
(
0
,
count
))
Assert
.
Equal
(
count
,
db
.
SetLengthAsync
(
key
).
Result
);
// SCARD for set
db
.
SetAdd
(
key
,
Guid
.
NewGuid
().
ToByteArray
(),
CommandFlags
.
FireAndForget
);
Assert
.
Equal
(
count
,
await
db
.
SetLengthAsync
(
key
));
// SCARD for set
}
var
result
=
await
db
.
SetMembersAsync
(
key
);
var
result
=
await
db
.
SetMembersAsync
(
key
);
Assert
.
Equal
(
count
,
result
.
Length
);
// SMEMBERS result length
Assert
.
Equal
(
count
,
result
.
Length
);
// SMEMBERS result length
}
}
...
@@ -50,19 +53,26 @@ public async Task SetUnion()
...
@@ -50,19 +53,26 @@ public async Task SetUnion()
var
key2
=
Me
()
+
":2"
;
var
key2
=
Me
()
+
":2"
;
var
dstkey
=
Me
()
+
":dst"
;
var
dstkey
=
Me
()
+
":dst"
;
await
db
.
KeyDeleteAsync
(
key1
);
const
int
count
=
(
int
)
5
e6
;
await
db
.
KeyDeleteAsync
(
key2
);
var
len1
=
await
db
.
SetLengthAsync
(
key1
);
var
len2
=
await
db
.
SetLengthAsync
(
key2
);
await
db
.
KeyDeleteAsync
(
dstkey
);
await
db
.
KeyDeleteAsync
(
dstkey
);
const
int
count
=
(
int
)
5
e6
;
if
(
len1
!=
count
||
len2
!=
count
)
foreach
(
var
_
in
Enumerable
.
Range
(
0
,
count
))
{
{
db
.
SetAdd
(
key1
,
Guid
.
NewGuid
().
ToByteArray
(),
CommandFlags
.
FireAndForget
);
await
db
.
KeyDeleteAsync
(
key1
);
db
.
SetAdd
(
key2
,
Guid
.
NewGuid
().
ToByteArray
(),
CommandFlags
.
FireAndForget
);
await
db
.
KeyDeleteAsync
(
key2
);
}
Assert
.
Equal
(
count
,
db
.
SetLengthAsync
(
key1
).
Result
);
// SCARD for set 1
Assert
.
Equal
(
count
,
db
.
SetLengthAsync
(
key2
).
Result
);
// SCARD for set 2
foreach
(
var
_
in
Enumerable
.
Range
(
0
,
count
))
{
db
.
SetAdd
(
key1
,
Guid
.
NewGuid
().
ToByteArray
(),
CommandFlags
.
FireAndForget
);
db
.
SetAdd
(
key2
,
Guid
.
NewGuid
().
ToByteArray
(),
CommandFlags
.
FireAndForget
);
}
Assert
.
Equal
(
count
,
await
db
.
SetLengthAsync
(
key1
));
// SCARD for set 1
Assert
.
Equal
(
count
,
await
db
.
SetLengthAsync
(
key2
));
// SCARD for set 2
}
await
db
.
SetCombineAndStoreAsync
(
SetOperation
.
Union
,
dstkey
,
key1
,
key2
);
await
db
.
SetCombineAndStoreAsync
(
SetOperation
.
Union
,
dstkey
,
key1
,
key2
);
var
dstLen
=
db
.
SetLength
(
dstkey
);
var
dstLen
=
db
.
SetLength
(
dstkey
);
Assert
.
Equal
(
count
*
2
,
dstLen
);
// SCARD for destination set
Assert
.
Equal
(
count
*
2
,
dstLen
);
// SCARD for destination set
...
...
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