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
157e18d7
Commit
157e18d7
authored
Sep 19, 2015
by
Jeremy Meng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable Browsable attribute which is from winforms for design time property window support.
Remove usage of ThreadPriority for netcore.
parent
6efda435
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
252 additions
and
220 deletions
+252
-220
ConfigurationOptions.cs
...xchange.Redis/StackExchange/Redis/ConfigurationOptions.cs
+5
-1
HashEntry.cs
StackExchange.Redis/StackExchange/Redis/HashEntry.cs
+100
-96
Message.cs
StackExchange.Redis/StackExchange/Redis/Message.cs
+2
-0
PhysicalConnection.cs
...kExchange.Redis/StackExchange/Redis/PhysicalConnection.cs
+4
-0
SocketManager.Poll.cs
...kExchange.Redis/StackExchange/Redis/SocketManager.Poll.cs
+6
-2
SocketManager.cs
StackExchange.Redis/StackExchange/Redis/SocketManager.cs
+6
-0
SortedSetEntry.cs
StackExchange.Redis/StackExchange/Redis/SortedSetEntry.cs
+129
-121
No files found.
StackExchange.Redis/StackExchange/Redis/ConfigurationOptions.cs
View file @
157e18d7
...
...
@@ -139,7 +139,11 @@ public static string TryNormalize(string value)
/// <summary>
/// Indicates whether the connection should be encrypted
/// </summary>
[
Obsolete
(
"Please use .Ssl instead of .UseSsl"
),
Browsable
(
false
),
EditorBrowsable
(
EditorBrowsableState
.
Never
)]
[
Obsolete
(
"Please use .Ssl instead of .UseSsl"
),
#if !NETCORE
Browsable
(
false
),
#endif
EditorBrowsable
(
EditorBrowsableState
.
Never
)]
public
bool
UseSsl
{
get
{
return
Ssl
;
}
set
{
Ssl
=
value
;
}
}
/// <summary>
...
...
StackExchange.Redis/StackExchange/Redis/HashEntry.cs
View file @
157e18d7
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
namespace
StackExchange.Redis
{
/// <summary>
/// Describes a hash-field (a name/value pair)
/// </summary>
public
struct
HashEntry
:
IEquatable
<
HashEntry
>
{
internal
readonly
RedisValue
name
,
value
;
/// <summary>
/// Initializes a HashEntry value
/// </summary>
public
HashEntry
(
RedisValue
name
,
RedisValue
value
)
{
this
.
name
=
name
;
this
.
value
=
value
;
}
/// <summary>
/// The name of the hash field
/// </summary>
public
RedisValue
Name
{
get
{
return
name
;
}
}
/// <summary>
/// The value of the hash field
/// </summary>
public
RedisValue
Value
{
get
{
return
value
;
}
}
/// <summary>
/// The name of the hash field
/// </summary>
[
Browsable
(
false
),
EditorBrowsable
(
EditorBrowsableState
.
Never
),
Obsolete
(
"Please use Name"
,
false
)]
public
RedisValue
Key
{
get
{
return
name
;
}
}
/// <summary>
/// Converts to a key/value pair
/// </summary>
public
static
implicit
operator
KeyValuePair
<
RedisValue
,
RedisValue
>(
HashEntry
value
)
{
return
new
KeyValuePair
<
RedisValue
,
RedisValue
>(
value
.
name
,
value
.
value
);
}
/// <summary>
/// Converts from a key/value pair
/// </summary>
public
static
implicit
operator
HashEntry
(
KeyValuePair
<
RedisValue
,
RedisValue
>
value
)
{
return
new
HashEntry
(
value
.
Key
,
value
.
Value
);
}
/// <summary>
/// See Object.ToString()
/// </summary>
public
override
string
ToString
()
{
return
name
+
": "
+
value
;
}
/// <summary>
/// See Object.GetHashCode()
/// </summary>
public
override
int
GetHashCode
()
{
return
name
.
GetHashCode
()
^
value
.
GetHashCode
();
}
/// <summary>
/// Compares two values for equality
/// </summary>
public
override
bool
Equals
(
object
obj
)
{
return
obj
is
HashEntry
&&
Equals
((
HashEntry
)
obj
);
}
/// <summary>
/// Compares two values for equality
/// </summary>
public
bool
Equals
(
HashEntry
value
)
{
return
this
.
name
==
value
.
name
&&
this
.
value
==
value
.
value
;
}
/// <summary>
/// Compares two values for equality
/// </summary>
public
static
bool
operator
==(
HashEntry
x
,
HashEntry
y
)
{
return
x
.
name
==
y
.
name
&&
x
.
value
==
y
.
value
;
}
/// <summary>
/// Compares two values for non-equality
/// </summary>
public
static
bool
operator
!=(
HashEntry
x
,
HashEntry
y
)
{
return
x
.
name
!=
y
.
name
||
x
.
value
!=
y
.
value
;
}
}
}
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
namespace
StackExchange.Redis
{
/// <summary>
/// Describes a hash-field (a name/value pair)
/// </summary>
public
struct
HashEntry
:
IEquatable
<
HashEntry
>
{
internal
readonly
RedisValue
name
,
value
;
/// <summary>
/// Initializes a HashEntry value
/// </summary>
public
HashEntry
(
RedisValue
name
,
RedisValue
value
)
{
this
.
name
=
name
;
this
.
value
=
value
;
}
/// <summary>
/// The name of the hash field
/// </summary>
public
RedisValue
Name
{
get
{
return
name
;
}
}
/// <summary>
/// The value of the hash field
/// </summary>
public
RedisValue
Value
{
get
{
return
value
;
}
}
/// <summary>
/// The name of the hash field
/// </summary>
[
#if !NETCORE
Browsable
(
false
),
#endif
EditorBrowsable
(
EditorBrowsableState
.
Never
),
Obsolete
(
"Please use Name"
,
false
)]
public
RedisValue
Key
{
get
{
return
name
;
}
}
/// <summary>
/// Converts to a key/value pair
/// </summary>
public
static
implicit
operator
KeyValuePair
<
RedisValue
,
RedisValue
>(
HashEntry
value
)
{
return
new
KeyValuePair
<
RedisValue
,
RedisValue
>(
value
.
name
,
value
.
value
);
}
/// <summary>
/// Converts from a key/value pair
/// </summary>
public
static
implicit
operator
HashEntry
(
KeyValuePair
<
RedisValue
,
RedisValue
>
value
)
{
return
new
HashEntry
(
value
.
Key
,
value
.
Value
);
}
/// <summary>
/// See Object.ToString()
/// </summary>
public
override
string
ToString
()
{
return
name
+
": "
+
value
;
}
/// <summary>
/// See Object.GetHashCode()
/// </summary>
public
override
int
GetHashCode
()
{
return
name
.
GetHashCode
()
^
value
.
GetHashCode
();
}
/// <summary>
/// Compares two values for equality
/// </summary>
public
override
bool
Equals
(
object
obj
)
{
return
obj
is
HashEntry
&&
Equals
((
HashEntry
)
obj
);
}
/// <summary>
/// Compares two values for equality
/// </summary>
public
bool
Equals
(
HashEntry
value
)
{
return
this
.
name
==
value
.
name
&&
this
.
value
==
value
.
value
;
}
/// <summary>
/// Compares two values for equality
/// </summary>
public
static
bool
operator
==(
HashEntry
x
,
HashEntry
y
)
{
return
x
.
name
==
y
.
name
&&
x
.
value
==
y
.
value
;
}
/// <summary>
/// Compares two values for non-equality
/// </summary>
public
static
bool
operator
!=(
HashEntry
x
,
HashEntry
y
)
{
return
x
.
name
!=
y
.
name
||
x
.
value
!=
y
.
value
;
}
}
}
StackExchange.Redis/StackExchange/Redis/Message.cs
View file @
157e18d7
...
...
@@ -2,7 +2,9 @@
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
#if FEATURE_SERIALIZATION
using
System.Runtime.Serialization
;
#endif
using
System.Text
;
using
System.Threading.Tasks
;
...
...
StackExchange.Redis/StackExchange/Redis/PhysicalConnection.cs
View file @
157e18d7
...
...
@@ -128,13 +128,17 @@ public void Dispose()
if
(
outStream
!=
null
)
{
multiplexer
.
Trace
(
"Disconnecting..."
,
physicalName
);
#if !NETCORE
try
{
outStream
.
Close
();
}
catch
{
}
#endif
try
{
outStream
.
Dispose
();
}
catch
{
}
outStream
=
null
;
}
if
(
netStream
!=
null
)
{
#if !NETCORE
try
{
netStream
.
Close
();
}
catch
{
}
#endif
try
{
netStream
.
Dispose
();
}
catch
{
}
netStream
=
null
;
}
...
...
StackExchange.Redis/StackExchange/Redis/SocketManager.Poll.cs
View file @
157e18d7
...
...
@@ -375,11 +375,15 @@ private void ReadImpl()
}
private
void
StartReader
()
{
{
#if !NETCORE
var
thread
=
new
Thread
(
read
,
32
*
1024
);
// don't need a huge stack
thread
.
Priority
=
ThreadPriority
.
AboveNormal
;
// time critical
#else
var
thread
=
new
Thread
(
read
);
// don't need a huge stack
#endif
thread
.
Name
=
name
+
":Read"
;
thread
.
IsBackground
=
true
;
thread
.
Priority
=
ThreadPriority
.
AboveNormal
;
// time critical
thread
.
Start
(
this
);
}
[
StructLayout
(
LayoutKind
.
Sequential
)]
...
...
StackExchange.Redis/StackExchange/Redis/SocketManager.cs
View file @
157e18d7
...
...
@@ -126,8 +126,12 @@ public SocketManager(string name = null)
// we need a dedicated writer, because when under heavy ambient load
// (a busy asp.net site, for example), workers are not reliable enough
#if !NETCORE
Thread
dedicatedWriter
=
new
Thread
(
writeAllQueues
,
32
*
1024
);
// don't need a huge stack;
dedicatedWriter
.
Priority
=
ThreadPriority
.
AboveNormal
;
// time critical
#else
Thread
dedicatedWriter
=
new
Thread
(
writeAllQueues
);
#endif
dedicatedWriter
.
Name
=
name
+
":Write"
;
dedicatedWriter
.
IsBackground
=
true
;
// should not keep process alive
dedicatedWriter
.
Start
(
this
);
// will self-exit when disposed
...
...
@@ -334,7 +338,9 @@ private void Shutdown(Socket socket)
{
OnShutdown
(
socket
);
try
{
socket
.
Shutdown
(
SocketShutdown
.
Both
);
}
catch
{
}
#if !NETCORE
try
{
socket
.
Close
();
}
catch
{
}
#endif
try
{
socket
.
Dispose
();
}
catch
{
}
}
}
...
...
StackExchange.Redis/StackExchange/Redis/SortedSetEntry.cs
View file @
157e18d7
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
namespace
StackExchange.Redis
{
/// <summary>
/// Describes a sorted-set element with the corresponding value
/// </summary>
public
struct
SortedSetEntry
:
IEquatable
<
SortedSetEntry
>,
IComparable
,
IComparable
<
SortedSetEntry
>
{
internal
readonly
RedisValue
element
;
internal
readonly
double
score
;
/// <summary>
/// Initializes a SortedSetEntry value
/// </summary>
public
SortedSetEntry
(
RedisValue
element
,
double
score
)
{
this
.
element
=
element
;
this
.
score
=
score
;
}
/// <summary>
/// The unique element stored in the sorted set
/// </summary>
public
RedisValue
Element
{
get
{
return
element
;
}
}
/// <summary>
/// The score against the element
/// </summary>
public
double
Score
{
get
{
return
score
;
}
}
/// <summary>
/// The score against the element
/// </summary>
[
Browsable
(
false
),
EditorBrowsable
(
EditorBrowsableState
.
Never
),
Obsolete
(
"Please use Score"
,
false
)]
public
double
Value
{
get
{
return
score
;
}
}
/// <summary>
/// The unique element stored in the sorted set
/// </summary>
[
Browsable
(
false
),
EditorBrowsable
(
EditorBrowsableState
.
Never
),
Obsolete
(
"Please use Element"
,
false
)]
public
RedisValue
Key
{
get
{
return
element
;
}
}
/// <summary>
/// Converts to a key/value pair
/// </summary>
public
static
implicit
operator
KeyValuePair
<
RedisValue
,
double
>(
SortedSetEntry
value
)
{
return
new
KeyValuePair
<
RedisValue
,
double
>(
value
.
element
,
value
.
score
);
}
/// <summary>
/// Converts from a key/value pair
/// </summary>
public
static
implicit
operator
SortedSetEntry
(
KeyValuePair
<
RedisValue
,
double
>
value
)
{
return
new
SortedSetEntry
(
value
.
Key
,
value
.
Value
);
}
/// <summary>
/// See Object.ToString()
/// </summary>
public
override
string
ToString
()
{
return
element
+
": "
+
score
;
}
/// <summary>
/// See Object.GetHashCode()
/// </summary>
public
override
int
GetHashCode
()
{
return
element
.
GetHashCode
()
^
score
.
GetHashCode
();
}
/// <summary>
/// Compares two values for equality
/// </summary>
public
override
bool
Equals
(
object
obj
)
{
return
obj
is
SortedSetEntry
&&
Equals
((
SortedSetEntry
)
obj
);
}
/// <summary>
/// Compares two values for equality
/// </summary>
public
bool
Equals
(
SortedSetEntry
value
)
{
return
this
.
score
==
value
.
score
&&
this
.
element
==
value
.
element
;
}
/// <summary>
/// Compares two values by score
/// </summary>
public
int
CompareTo
(
SortedSetEntry
value
)
{
return
this
.
score
.
CompareTo
(
value
.
score
);
}
/// <summary>
/// Compares two values by score
/// </summary>
public
int
CompareTo
(
object
value
)
{
return
value
is
SortedSetEntry
?
CompareTo
((
SortedSetEntry
)
value
)
:
-
1
;
}
/// <summary>
/// Compares two values for equality
/// </summary>
public
static
bool
operator
==(
SortedSetEntry
x
,
SortedSetEntry
y
)
{
return
x
.
score
==
y
.
score
&&
x
.
element
==
y
.
element
;
}
/// <summary>
/// Compares two values for non-equality
/// </summary>
public
static
bool
operator
!=(
SortedSetEntry
x
,
SortedSetEntry
y
)
{
return
x
.
score
!=
y
.
score
||
x
.
element
!=
y
.
element
;
}
}
}
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
namespace
StackExchange.Redis
{
/// <summary>
/// Describes a sorted-set element with the corresponding value
/// </summary>
public
struct
SortedSetEntry
:
IEquatable
<
SortedSetEntry
>,
IComparable
,
IComparable
<
SortedSetEntry
>
{
internal
readonly
RedisValue
element
;
internal
readonly
double
score
;
/// <summary>
/// Initializes a SortedSetEntry value
/// </summary>
public
SortedSetEntry
(
RedisValue
element
,
double
score
)
{
this
.
element
=
element
;
this
.
score
=
score
;
}
/// <summary>
/// The unique element stored in the sorted set
/// </summary>
public
RedisValue
Element
{
get
{
return
element
;
}
}
/// <summary>
/// The score against the element
/// </summary>
public
double
Score
{
get
{
return
score
;
}
}
/// <summary>
/// The score against the element
/// </summary>
[
#if !NETCORE
Browsable
(
false
),
#endif
EditorBrowsable
(
EditorBrowsableState
.
Never
),
Obsolete
(
"Please use Score"
,
false
)]
public
double
Value
{
get
{
return
score
;
}
}
/// <summary>
/// The unique element stored in the sorted set
/// </summary>
[
#if !NETCORE
Browsable
(
false
),
#endif
EditorBrowsable
(
EditorBrowsableState
.
Never
),
Obsolete
(
"Please use Element"
,
false
)]
public
RedisValue
Key
{
get
{
return
element
;
}
}
/// <summary>
/// Converts to a key/value pair
/// </summary>
public
static
implicit
operator
KeyValuePair
<
RedisValue
,
double
>(
SortedSetEntry
value
)
{
return
new
KeyValuePair
<
RedisValue
,
double
>(
value
.
element
,
value
.
score
);
}
/// <summary>
/// Converts from a key/value pair
/// </summary>
public
static
implicit
operator
SortedSetEntry
(
KeyValuePair
<
RedisValue
,
double
>
value
)
{
return
new
SortedSetEntry
(
value
.
Key
,
value
.
Value
);
}
/// <summary>
/// See Object.ToString()
/// </summary>
public
override
string
ToString
()
{
return
element
+
": "
+
score
;
}
/// <summary>
/// See Object.GetHashCode()
/// </summary>
public
override
int
GetHashCode
()
{
return
element
.
GetHashCode
()
^
score
.
GetHashCode
();
}
/// <summary>
/// Compares two values for equality
/// </summary>
public
override
bool
Equals
(
object
obj
)
{
return
obj
is
SortedSetEntry
&&
Equals
((
SortedSetEntry
)
obj
);
}
/// <summary>
/// Compares two values for equality
/// </summary>
public
bool
Equals
(
SortedSetEntry
value
)
{
return
this
.
score
==
value
.
score
&&
this
.
element
==
value
.
element
;
}
/// <summary>
/// Compares two values by score
/// </summary>
public
int
CompareTo
(
SortedSetEntry
value
)
{
return
this
.
score
.
CompareTo
(
value
.
score
);
}
/// <summary>
/// Compares two values by score
/// </summary>
public
int
CompareTo
(
object
value
)
{
return
value
is
SortedSetEntry
?
CompareTo
((
SortedSetEntry
)
value
)
:
-
1
;
}
/// <summary>
/// Compares two values for equality
/// </summary>
public
static
bool
operator
==(
SortedSetEntry
x
,
SortedSetEntry
y
)
{
return
x
.
score
==
y
.
score
&&
x
.
element
==
y
.
element
;
}
/// <summary>
/// Compares two values for non-equality
/// </summary>
public
static
bool
operator
!=(
SortedSetEntry
x
,
SortedSetEntry
y
)
{
return
x
.
score
!=
y
.
score
||
x
.
element
!=
y
.
element
;
}
}
}
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