View Source Cachex.Router.Mod (Cachex v4.0.2)
Routing implementation based on basic hashing.
This router provides the simplest (and quickest!) implementation for clusters of a static size. Provided keys are hashed and routed to a node via the modulo operation. Please note that the hash algorithm should not be relied upon and is not considered part of the public API.
The initialization of this router accepts a :nodes
option which enables
the user to define the nodes to route amongst. If this is not provided the
router will default to detecting a cluster via Node.self/0
and Node.list/1
.
Summary
Functions
Initialize a modulo routing state for a cache.
Retrieve the list of nodes from a modulo routing state.
Route a key to a node in a modulo routing state.
Functions
Initialize a modulo routing state for a cache.
Options
:nodes
The
:nodes
option allows a user to provide a list of nodes to treat as a cluster. If this is not provided, the cluster will be inferred by usingNode.self/0
andNode.list/1
.
Retrieve the list of nodes from a modulo routing state.
Route a key to a node in a modulo routing state.