Skip to content

Commit

Permalink
Upgrade to newer redis client version
Browse files Browse the repository at this point in the history
Fixed redis Count and server getter
  • Loading branch information
MichaCo committed Jan 20, 2016
1 parent c8855ce commit 1b22ddb
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": { "version": "1.0.0-rc1-update1" },
"sdk": { },
"projects": [
"src",
"test"
Expand Down
22 changes: 12 additions & 10 deletions src/CacheManager.StackExchange.Redis/RedisCacheHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ public override int Count
{
get
{
var server = this.GetServers(this.Connection).First(p => !p.IsSlave && p.IsConnected);
if (server == null)
var count = 0;
foreach(var server in this.GetServers().Where(p => !p.IsSlave && p.IsConnected))
{
throw new InvalidOperationException("No active master found.");
count += (int)server.DatabaseSize(this.RedisConfiguration.Database);
}

// aprox size, only size on the master..
return (int)server.DatabaseSize(this.RedisConfiguration.Database);
return count;
}
}

Expand Down Expand Up @@ -104,10 +104,10 @@ private RedisConfiguration RedisConfiguration
/// </summary>
public override void Clear()
{
foreach (var server in this.GetServers(this.Connection)
foreach (var server in this.GetServers()
.Where(p => !p.IsSlave))
{
server.FlushDatabase(this.RedisConfiguration.Database);
this.Retry(() => server.FlushDatabase(this.RedisConfiguration.Database));
}
}

Expand Down Expand Up @@ -139,12 +139,14 @@ public override void ClearRegion(string region)
/// </summary>
/// <param name="muxer">The muxer.</param>
/// <returns>The list of servers.</returns>
public IEnumerable<StackRedis.IServer> GetServers(StackRedis.ConnectionMultiplexer muxer)
public IEnumerable<StackRedis.IServer> GetServers()
{
EndPoint[] endpoints = muxer.GetEndPoints();
var connection = this.Connection;

EndPoint[] endpoints = connection.GetEndPoints();
foreach (var endpoint in endpoints)
{
var server = muxer.GetServer(endpoint);
var server = connection.GetServer(endpoint);
yield return server;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/CacheManager.StackExchange.Redis/project.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
{
"version": "0.7.1-*",
"description": "CacheManager is an open source abstraction layer for caching written in C#. It supports various cache providers and implements many advanced features. This package contains the specific cache handle for Redis.",
"authors": [ "MichaConrad" ],
Expand Down Expand Up @@ -30,7 +30,7 @@
},
"dependencies": {
"CacheManager.Core": "",
"StackExchange.Redis": "1.0.450"
"StackExchange.Redis": "1.0.488"
},
"frameworks": {
"net40": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"run": {
"commandName": "run",
"sdkVersion": "dnx-coreclr-win-x86.1.0.0-rc1-update1"
"sdkVersion": "dnx-clr-win-x86.1.0.0-rc2-16384"
}
}
}
2 changes: 1 addition & 1 deletion test/CacheManager.Tests/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"CacheManager.Web": "",
"FluentAssertions": "4.1.0",
"Moq": "4.2.1510.2205",
"xunit.runner.aspnet": "2.0.0-aspnet-rc1-*"
"xunit.runner.aspnet": "2.0.0-aspnet-*"
},
"frameworks": {
"dnx451": {
Expand Down
2 changes: 1 addition & 1 deletion tools/redis/master.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
port 6379
dbfilename master.rdb
databases 2000
maxmemory 250mb
maxmemory 2500mb

0 comments on commit 1b22ddb

Please sign in to comment.