Skip to content

Commit

Permalink
Using new version of SimplSockets; fixed bug in remove item callback …
Browse files Browse the repository at this point in the history
…test
  • Loading branch information
haneytron committed Oct 3, 2014
1 parent e0f8b97 commit c1f670c
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
10 changes: 10 additions & 0 deletions Dache.CacheHost/Communication/CacheHostServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ internal class CacheHostServer : ICacheHostContract, IRunnable
// The logger
private readonly ILogger _logger;

// The invalid command string list
private readonly List<string> _invalidCommandStringList = new List<string> { "invalid command" };

/// <summary>
/// The constructor.
/// </summary>
Expand Down Expand Up @@ -103,6 +106,7 @@ public CacheHostServer(IMemCache memCache, ITagRoutingTable tagRoutingTable, ILo

// Hook into received message event
_server.MessageReceived += ReceiveMessage;
_server.Error += (sender, e) => { _logger.Warn("Dache Client Disconnected", e.Exception); };
}

private void ReceiveMessage(object sender, MessageReceivedArgs e)
Expand Down Expand Up @@ -326,6 +330,12 @@ private byte[] ProcessCommand(string command)
}
break;
}
default:
{
// Invalid command
commandResult = CreateCommandResult(_invalidCommandStringList);
break;
}
}

// Return the result - may be null if there was no valid message
Expand Down
4 changes: 2 additions & 2 deletions Dache.CacheHost/Dache.CacheHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
<Reference Include="SharpMemoryCache">
<HintPath>..\packages\SharpMemoryCache.1.0.0\lib\SharpMemoryCache.dll</HintPath>
</Reference>
<Reference Include="SimplSockets, Version=1.3.0.37244, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="SimplSockets, Version=1.3.0.42869, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\SimplSockets.1.3.0\lib\SimplSockets.dll</HintPath>
<HintPath>..\packages\SimplSockets.1.3.1\lib\SimplSockets.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
2 changes: 1 addition & 1 deletion Dache.CacheHost/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="SharpMemoryCache" version="1.0.0" targetFramework="net45" />
<package id="SimplSockets" version="1.3.0" targetFramework="net40" />
<package id="SimplSockets" version="1.3.1" targetFramework="net40" />
</packages>
4 changes: 2 additions & 2 deletions Dache.Client/Dache.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
<Reference Include="SharpMemoryCache">
<HintPath>..\packages\SharpMemoryCache.1.0.0\lib\SharpMemoryCache.dll</HintPath>
</Reference>
<Reference Include="SimplSockets, Version=1.3.0.37244, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="SimplSockets, Version=1.3.0.42869, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\SimplSockets.1.3.0\lib\SimplSockets.dll</HintPath>
<HintPath>..\packages\SimplSockets.1.3.1\lib\SimplSockets.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
Expand Down
2 changes: 1 addition & 1 deletion Dache.Client/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="SharpMemoryCache" version="1.0.0" targetFramework="net45" />
<package id="SimplSockets" version="1.3.0" targetFramework="net40" />
<package id="SimplSockets" version="1.3.1" targetFramework="net40" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static void Run()

cacheClient.HostDisconnected += (sender, e) => { Console.WriteLine("*** Host disconnected"); };
cacheClient.HostReconnected += (sender, e) => { Console.WriteLine("*** Host reconnected"); };
cacheClient.CacheItemExpired += (sender, e) => { Interlocked.Increment(ref totalCallbacks); Console.WriteLine(string.Format("Cache key expired: {1}, Total Removed: {1}", e.CacheKey, totalCallbacks)); };
cacheClient.CacheItemExpired += (sender, e) => { Interlocked.Increment(ref totalCallbacks); Console.WriteLine(string.Format("Cache key expired: {0}, Total Removed: {1}", e.CacheKey, totalCallbacks)); };

// Add items
for (int i = 0; i < itemsToAdd; i++)
Expand Down

0 comments on commit c1f670c

Please sign in to comment.