Skip to content

Commit

Permalink
Added helper method to return the MemcachedNode for a given key
Browse files Browse the repository at this point in the history
  • Loading branch information
smadappa committed Dec 4, 2019
1 parent 5456ee7 commit ebc622a
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.netflix.evcache.pool.EVCacheClientPool;

import net.spy.memcached.CachedData;
import net.spy.memcached.MemcachedNode;

public class EVCacheEvent {

Expand Down Expand Up @@ -166,6 +167,15 @@ public Collection<String> getCanonicalKeys() {
return keyList;
}

public Collection<MemcachedNode> getMemcachedNode(EVCacheKey evckey) {
final Collection<MemcachedNode> nodeList = new ArrayList<MemcachedNode>(clients.size());
for(EVCacheClient client : clients) {
String key = evckey.getHashKey() == null ? evckey.getCanonicalKey() : evckey.getHashKey();
nodeList.add(client.getNodeLocator().getPrimary(key));
}
return nodeList;
}

/**
* @deprecated replaced by {@link #setEVCacheKeys(Collection)}
*/
Expand Down

0 comments on commit ebc622a

Please sign in to comment.