forked from SharpRepository/SharpRepository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed from ServiceStack to StackExchange.Redis
ServiceStack started a commercial license with their newest version with low limits on usage of the free version. So we switch to the free StackExchange.Redis
- Loading branch information
Jeff Treuting
committed
Oct 17, 2014
1 parent
28e4b2d
commit 92d3a4c
Showing
196 changed files
with
128,306 additions
and
4,570 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using StackExchange.Redis; | ||
|
||
namespace SharpRepository.Caching.Redis | ||
{ | ||
public static class RedisConnector | ||
{ | ||
public static ConnectionMultiplexer Connection { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using Newtonsoft.Json; | ||
using StackExchange.Redis; | ||
|
||
namespace SharpRepository.Caching.Redis | ||
{ | ||
public static class StackExchangeRedisExtensions | ||
{ | ||
public static T Get<T>(this IDatabase cache, string key) | ||
{ | ||
return Deserialize<T>(cache.StringGet(key)); | ||
} | ||
|
||
public static object Get(this IDatabase cache, string key) | ||
{ | ||
return Deserialize<object>(cache.StringGet(key)); | ||
} | ||
|
||
public static void Set(this IDatabase cache, string key, object value, TimeSpan? expiry = null) | ||
{ | ||
cache.StringSet(key, Serialize(value), expiry); | ||
} | ||
|
||
static string Serialize(object o) | ||
{ | ||
if (o == null) | ||
{ | ||
return null; | ||
} | ||
|
||
return JsonConvert.SerializeObject(o); | ||
} | ||
|
||
static T Deserialize<T>(string value) | ||
{ | ||
if (value == null) | ||
{ | ||
return default(T); | ||
} | ||
|
||
return JsonConvert.DeserializeObject<T>(value); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<runtime> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" /> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="ServiceStack.Common" version="4.0.32" targetFramework="net40" /> | ||
<package id="ServiceStack.Interfaces" version="4.0.32" targetFramework="net40" /> | ||
<package id="ServiceStack.Redis" version="4.0.32" targetFramework="net40" /> | ||
<package id="ServiceStack.Text" version="4.0.32" targetFramework="net40" /> | ||
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net40" /> | ||
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net40" /> | ||
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net40" /> | ||
<package id="Newtonsoft.Json" version="6.0.5" targetFramework="net40" /> | ||
<package id="StackExchange.Redis" version="1.0.333" targetFramework="net40" /> | ||
</packages> |
Oops, something went wrong.