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
137aa885
Commit
137aa885
authored
Apr 14, 2014
by
Marc Gravell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14 from ccorsano/master
Fix RedisServer.Save(SaveType.BackgroundSave)
parents
9b5f38a0
0d355244
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
4 deletions
+41
-4
BgSaveResponse.cs
StackExchange.Redis.Tests/Issues/BgSaveResponse.cs
+23
-0
StackExchange.Redis.Tests.csproj
StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj
+1
-0
RedisLiterals.cs
StackExchange.Redis/StackExchange/Redis/RedisLiterals.cs
+1
-0
RedisServer.cs
StackExchange.Redis/StackExchange/Redis/RedisServer.cs
+13
-2
ResultProcessor.cs
StackExchange.Redis/StackExchange/Redis/ResultProcessor.cs
+3
-2
No files found.
StackExchange.Redis.Tests/Issues/BgSaveResponse.cs
0 → 100644
View file @
137aa885
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
NUnit.Framework
;
namespace
StackExchange.Redis.Tests.Issues
{
[
TestFixture
]
public
class
BgSaveResponse
:
TestBase
{
[
Test
]
public
void
ShouldntThrowException
()
{
using
(
var
conn
=
Create
(
null
,
null
,
true
))
{
var
Server
=
GetServer
(
conn
);
Server
.
Save
(
SaveType
.
BackgroundSave
);
}
}
}
}
StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj
View file @
137aa885
...
@@ -71,6 +71,7 @@
...
@@ -71,6 +71,7 @@
<Compile
Include=
"Expiry.cs"
/>
<Compile
Include=
"Expiry.cs"
/>
<Compile
Include=
"Config.cs"
/>
<Compile
Include=
"Config.cs"
/>
<Compile
Include=
"FloatingPoint.cs"
/>
<Compile
Include=
"FloatingPoint.cs"
/>
<Compile
Include=
"Issues\BGSAVEResponse.cs"
/>
<Compile
Include=
"Issues\Issue6.cs"
/>
<Compile
Include=
"Issues\Issue6.cs"
/>
<Compile
Include=
"Issues\SO22786599.cs"
/>
<Compile
Include=
"Issues\SO22786599.cs"
/>
<Compile
Include=
"Keys.cs"
/>
<Compile
Include=
"Keys.cs"
/>
...
...
StackExchange.Redis/StackExchange/Redis/RedisLiterals.cs
View file @
137aa885
...
@@ -65,6 +65,7 @@ public static readonly RedisValue
...
@@ -65,6 +65,7 @@ public static readonly RedisValue
public
static
readonly
byte
[]
BytesOK
=
Encoding
.
UTF8
.
GetBytes
(
"OK"
);
public
static
readonly
byte
[]
BytesOK
=
Encoding
.
UTF8
.
GetBytes
(
"OK"
);
public
static
readonly
byte
[]
BytesPONG
=
Encoding
.
UTF8
.
GetBytes
(
"PONG"
);
public
static
readonly
byte
[]
BytesPONG
=
Encoding
.
UTF8
.
GetBytes
(
"PONG"
);
public
static
readonly
byte
[]
BytesBackgroundSavingStarted
=
Encoding
.
UTF8
.
GetBytes
(
"Background saving started"
);
public
static
readonly
byte
[]
ByteWildcard
=
{
(
byte
)
'*'
};
public
static
readonly
byte
[]
ByteWildcard
=
{
(
byte
)
'*'
};
internal
static
RedisValue
Get
(
Bitwise
operation
)
internal
static
RedisValue
Get
(
Bitwise
operation
)
{
{
...
...
StackExchange.Redis/StackExchange/Redis/RedisServer.cs
View file @
137aa885
...
@@ -251,13 +251,13 @@ public void MakeMaster(ReplicationChangeOptions options, TextWriter log = null)
...
@@ -251,13 +251,13 @@ public void MakeMaster(ReplicationChangeOptions options, TextWriter log = null)
public
void
Save
(
SaveType
type
,
CommandFlags
flags
=
CommandFlags
.
None
)
public
void
Save
(
SaveType
type
,
CommandFlags
flags
=
CommandFlags
.
None
)
{
{
var
msg
=
GetSaveMessage
(
type
,
flags
);
var
msg
=
GetSaveMessage
(
type
,
flags
);
ExecuteSync
(
msg
,
ResultProcessor
.
DemandOK
);
ExecuteSync
(
msg
,
GetSaveResultProcessor
(
type
)
);
}
}
public
Task
SaveAsync
(
SaveType
type
,
CommandFlags
flags
=
CommandFlags
.
None
)
public
Task
SaveAsync
(
SaveType
type
,
CommandFlags
flags
=
CommandFlags
.
None
)
{
{
var
msg
=
GetSaveMessage
(
type
,
flags
);
var
msg
=
GetSaveMessage
(
type
,
flags
);
return
ExecuteAsync
(
msg
,
ResultProcessor
.
DemandOK
);
return
ExecuteAsync
(
msg
,
GetSaveResultProcessor
(
type
)
);
}
}
public
bool
ScriptExists
(
string
script
,
CommandFlags
flags
=
CommandFlags
.
None
)
public
bool
ScriptExists
(
string
script
,
CommandFlags
flags
=
CommandFlags
.
None
)
...
@@ -541,6 +541,17 @@ Message GetSaveMessage(SaveType type, CommandFlags flags = CommandFlags.None)
...
@@ -541,6 +541,17 @@ Message GetSaveMessage(SaveType type, CommandFlags flags = CommandFlags.None)
default
:
throw
new
ArgumentOutOfRangeException
(
"type"
);
default
:
throw
new
ArgumentOutOfRangeException
(
"type"
);
}
}
}
}
ResultProcessor
<
bool
>
GetSaveResultProcessor
(
SaveType
type
)
{
switch
(
type
)
{
case
SaveType
.
BackgroundRewriteAppendOnlyFile
:
return
ResultProcessor
.
DemandOK
;
case
SaveType
.
BackgroundSave
:
return
ResultProcessor
.
BackgroundSaveStarted
;
default
:
throw
new
ArgumentOutOfRangeException
(
"type"
);
}
}
struct
KeysScanResult
struct
KeysScanResult
{
{
public
static
readonly
ResultProcessor
<
KeysScanResult
>
Processor
=
new
KeysResultProcessor
();
public
static
readonly
ResultProcessor
<
KeysScanResult
>
Processor
=
new
KeysResultProcessor
();
...
...
StackExchange.Redis/StackExchange/Redis/ResultProcessor.cs
View file @
137aa885
...
@@ -13,12 +13,13 @@ abstract class ResultProcessor
...
@@ -13,12 +13,13 @@ abstract class ResultProcessor
public
static
readonly
ResultProcessor
<
bool
>
public
static
readonly
ResultProcessor
<
bool
>
Boolean
=
new
BooleanProcessor
(),
Boolean
=
new
BooleanProcessor
(),
DemandOK
=
new
ExpectBasicStringProcessor
(
RedisLiterals
.
BytesOK
),
DemandOK
=
new
ExpectBasicStringProcessor
(
RedisLiterals
.
BytesOK
),
DemandPONG
=
new
ExpectBasicStringProcessor
(
"PONG"
),
DemandPONG
=
new
ExpectBasicStringProcessor
(
RedisLiterals
.
BytesPONG
),
DemandZeroOrOne
=
new
DemandZeroOrOneProcessor
(),
DemandZeroOrOne
=
new
DemandZeroOrOneProcessor
(),
AutoConfigure
=
new
AutoConfigureProcessor
(),
AutoConfigure
=
new
AutoConfigureProcessor
(),
TrackSubscriptions
=
new
TrackSubscriptionsProcessor
(),
TrackSubscriptions
=
new
TrackSubscriptionsProcessor
(),
Tracer
=
new
TracerProcessor
(
false
),
Tracer
=
new
TracerProcessor
(
false
),
EstablishConnection
=
new
TracerProcessor
(
true
);
EstablishConnection
=
new
TracerProcessor
(
true
),
BackgroundSaveStarted
=
new
ExpectBasicStringProcessor
(
RedisLiterals
.
BytesBackgroundSavingStarted
);
public
static
readonly
ResultProcessor
<
byte
[
]>
public
static
readonly
ResultProcessor
<
byte
[
]>
ByteArray
=
new
ByteArrayProcessor
(),
ByteArray
=
new
ByteArrayProcessor
(),
...
...
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