Created
December 7, 2012 19:44
-
-
Save anonymous/4235931 to your computer and use it in GitHub Desktop.
Dummy Node Locator for MemcachedClient
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
using System.Collections.Generic; | |
using Enyim.Caching.Memcached; | |
using log4net; | |
namespace CacheReplicationAndFailoverTester | |
{ | |
public class DumbNodeLocator : IMemcachedNodeLocator | |
{ | |
private static readonly ILog Logger = LogManager.GetLogger(typeof (DumbNodeLocator)); | |
private IList<IMemcachedNode> _nodes; | |
/// <summary> | |
/// Always returns the first node in the list | |
/// </summary> | |
public DumbNodeLocator() | |
{ | |
Logger.Debug("Constructor called"); | |
_nodes = new List<IMemcachedNode>(); | |
} | |
public void Initialize(IList<IMemcachedNode> nodes) | |
{ | |
Logger.Debug("Initialize called"); | |
_nodes = nodes; | |
} | |
public IMemcachedNode Locate(string key) | |
{ | |
Logger.Debug("Locate called"); | |
return _nodes[0]; | |
} | |
public IEnumerable<IMemcachedNode> GetWorkingNodes() | |
{ | |
Logger.Debug("GetWorkingNodes called"); | |
return _nodes; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment