Home

Awesome

Nebulex.Adapters.Horde

This implements a Nebulex adapter using Horde to store in-memory distributed data, you can check Horde page to see more details about its advantages.

This is a alternative to Nebulex Partitioned Cache that uses :pg under the hood.

NOTE: This adapter only supports Nebulex v2.0.0 onwards.

Overall features

Installation

Add nebulex_adapters_horde to your list of dependencies in mix.exs:

def deps do
  [
    {:nebulex_adapters_horde, "~> 1.0.1"}
  ]
end

Usage

You can define a Cache using this adapter as follows:

defmodule MyApp.Cache do
  use Nebulex.Cache,
    otp_app: :my_app,
    adapter: Nebulex.Adapters.Horde,
    horde: [
      members: :auto,
      process_redistribution: :passive
      # any other Horde options ...
    ]
end

And in the application.ex file:

def start(_type, _args) do
  children = [
    {MyApp.Cache, []},
  ]

  ...
end

Roadmap

Testing

Since Nebulex.Adapters.Horde uses the support modules and shared tests from Nebulex and by default its test folder is not included in the Hex dependency, the following steps are required for running the tests.

First of all, make sure you set the environment variable NEBULEX_PATH to nebulex:

export NEBULEX_PATH=nebulex

Second, make sure you fetch :nebulex dependency directly from GtiHub by running:

mix nbx.setup

Third, fetch deps:

mix deps.get

Finally, you can run the tests:

mix test

Running Benchmarks

Everything related to benchmark is in benchmarks/benchmarks.exs, to run it you can use: MIX_ENV=test mix run benchmarks/benchmarks.exs

The details of benchmark of Horde against Partitioned adapter is in benchmarks/details.txt

Notes

This is heavily influenced by nebulex_adapters_cache by cabol, I've used a lot of the testing method implemented there