View Source Cachex.Router behaviour (Cachex v4.0.1)
Module controlling routing behaviour definitions.
This module defines the router implementations for Cachex, allowing the user to route commands between nodes in a cache cluster. This means that users can provide their own routing and rebalancing logic without having to depend on it being included in Cachex.
Summary
Callbacks
Create a child specification to back a routing state.
Initialize a routing state for a cache.
Retrieve the list of nodes from a routing state.
Route a key to a node in a routing state.
Functions
Retrieve all currently connected nodes (including this one).
Retrieve all routable nodes for a cache.
Dispatches a call to an appropriate execution environment.
Executes a previously dispatched action..
Callbacks
@callback children(cache :: Cachex.t(), options :: Keyword.t()) :: Supervisor.child_spec()
Create a child specification to back a routing state.
Initialize a routing state for a cache.
Please see all child implementations for supported options.
Retrieve the list of nodes from a routing state.
Route a key to a node in a routing state.
Functions
@spec connected() :: [atom()]
Retrieve all currently connected nodes (including this one).
Retrieve all routable nodes for a cache.
Dispatches a call to an appropriate execution environment.
This acts as a macro just to avoid the overhead of slicing up module names at runtime, when they can be guaranteed at compile time much more easily.
Executes a previously dispatched action..