[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/horde/framework/Horde/Support/ -> ConsistentHash.php (summary)

(no description)

File Size: 244 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Horde_Support_ConsistentHash:: (8 methods):
  __construct()
  get()
  getNodes()
  add()
  addNodes()
  remove()
  hash()
  _updateCircle()


Class: Horde_Support_ConsistentHash  - X-Ref

For a thorough description of consistent hashing, see
http://www.spiteful.com/2008/03/17/programmers-toolbox-part-3-consistent-hashing/,
and also the original paper:
http://www8.org/w8-papers/2a-webserver/caching/paper2.html

Copyright 2007-2014 Horde LLC (http://www.horde.org/)

__construct($nodes = array()   X-Ref
Create a new consistent hash, with initial $nodes at $numberOfReplicas

param: array    $nodes             Initial array of nodes to add at $weight.
param: integer  $weight            The weight for the initial node list.
param: integer  $numberOfReplicas  The number of points on the circle to generate for each node.

get($key)   X-Ref
Get the primary node for $key.

param: string $key  The key to look up.
param: string  The primary node for $key.

getNodes($key, $count = 5)   X-Ref
Get an ordered list of nodes for $key.

param: string   $key    The key to look up.
param: integer  $count  The number of nodes to look up.
return: array  An ordered array of nodes.

add($node, $weight = 1)   X-Ref
Add $node with weight $weight

param: mixed $node

addNodes($nodes, $weight = 1)   X-Ref
Add multiple nodes to the hash with the same weight.

param: array    $nodes   An array of nodes.
param: integer  $weight  The weight to add the nodes with.

remove($node)   X-Ref
Remove $node from the hash.

param: mixed $node

hash($key)   X-Ref
Expose the hash function for testing, probing, and extension.

param: string $key
return: string Hash value

_updateCircle()   X-Ref
Maintain the circle and arrays of points.




Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1