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
3e9fee8b
Commit
3e9fee8b
authored
Jun 15, 2018
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RawResult - when parsing, don't over-allocate the scratch buffer used for the parse
parent
7c709ecf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
Program.cs
BasicTest/Program.cs
+5
-3
RawResult.cs
StackExchange.Redis/StackExchange/Redis/RawResult.cs
+1
-1
No files found.
BasicTest/Program.cs
View file @
3e9fee8b
...
...
@@ -8,8 +8,9 @@ internal static class Program
{
public
static
async
Task
Main
()
{
using
(
var
conn
=
await
ConnectionMultiplexer
.
ConnectAsync
(
"127.0.0.1:6379"
))
using
(
var
conn
=
await
ConnectionMultiplexer
.
ConnectAsync
(
"127.0.0.1:6379
,syncTimeout=2000
"
))
{
conn
.
ConnectionFailed
+=
(
sender
,
e
)
=>
Console
.
WriteLine
(
$"
{
e
.
ConnectionType
}
,
{
e
.
FailureType
}
:
{
e
.
Exception
.
Message
}
"
);
var
db
=
conn
.
GetDatabase
(
3
);
var
batch
=
db
.
CreateBatch
();
...
...
@@ -29,10 +30,11 @@ public static async Task Main()
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
int
x
=
rand
.
Next
(
50
);
Console
.
WriteLine
(
$"
{
i
}
:
{
x
}
"
);
expected
+=
x
;
db
.
StringIncrement
(
counter
,
x
,
CommandFlags
.
FireAndForget
);
db
.
StringIncrement
(
counter
,
x
);
//
, CommandFlags.FireAndForget);
}
int
actual
=
(
int
)
db
.
StringGet
(
counter
);
int
actual
=
(
int
)
await
db
.
StringGetAsync
(
counter
);
Console
.
WriteLine
(
$"
{
expected
}
vs
{
actual
}
"
);
}
}
...
...
StackExchange.Redis/StackExchange/Redis/RawResult.cs
View file @
3e9fee8b
...
...
@@ -373,7 +373,7 @@ internal bool TryGetInt64(out long value)
if
(
_payload
.
IsSingleSegment
)
return
RedisValue
.
TryParseInt64
(
_payload
.
First
.
Span
,
out
value
);
Span
<
byte
>
span
=
stackalloc
byte
[
PhysicalConnection
.
MaxInt64TextLen
];
Span
<
byte
>
span
=
stackalloc
byte
[
(
int
)
_payload
.
Length
];
// we already checked the length was <= MaxInt64TextLen
_payload
.
CopyTo
(
span
);
return
RedisValue
.
TryParseInt64
(
span
,
out
value
);
}
...
...
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