Package net.spy.memcached
Class ArrayModNodeLocator
java.lang.Object
net.spy.memcached.ArrayModNodeLocator
- All Implemented Interfaces:
NodeLocator
NodeLocator implementation for dealing with simple array lookups using a
modulus of the hash code and node list length.
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct an ArraymodNodeLocator over the given array of nodes and using the given hash algorithm. -
Method Summary
Modifier and TypeMethodDescriptiongetAll()Get all memcached nodes.getPrimary(String k) Get the primary location for the given key.Create a read-only copy of this NodeLocator.Get an iterator over the sequence of nodes that make up the backup locations for a given key.voidupdateLocator(List<MemcachedNode> newNodes) Update locator status.
-
Constructor Details
-
ArrayModNodeLocator
Construct an ArraymodNodeLocator over the given array of nodes and using the given hash algorithm.- Parameters:
n- the array of nodesalg- the hash algorithm
-
-
Method Details
-
getAll
Description copied from interface:NodeLocatorGet all memcached nodes. This is useful for broadcasting messages.- Specified by:
getAllin interfaceNodeLocator
-
getPrimary
Description copied from interface:NodeLocatorGet the primary location for the given key.- Specified by:
getPrimaryin interfaceNodeLocator- Parameters:
k- the object key- Returns:
- the QueueAttachment containing the primary storage for a key
-
getSequence
Description copied from interface:NodeLocatorGet an iterator over the sequence of nodes that make up the backup locations for a given key.- Specified by:
getSequencein interfaceNodeLocator- Parameters:
k- the object key- Returns:
- the sequence of backup nodes.
-
getReadonlyCopy
Description copied from interface:NodeLocatorCreate a read-only copy of this NodeLocator.- Specified by:
getReadonlyCopyin interfaceNodeLocator
-
updateLocator
Description copied from interface:NodeLocatorUpdate locator status.- Specified by:
updateLocatorin interfaceNodeLocator- Parameters:
newNodes- New locator nodes.
-