RedixClustered
Cluster support for Redix, and other stuff! Currently:
- Very WIP
- Needs documentation
- Overall probably too opinionated
Ported from some other PRX applications, and working to improve.
Installation
Add redix_clustered
to your list of dependencies in mix.exs
:
def deps do
[
{:redix_clustered, "~> 0.1.0"}
]
end
Then just add your cluster as a child of your application:
children = [
{RedixClustered, name: :my_redis, host: "127.0.0.1", port: 6379, prefix: "anything"}
]
And then you can run commands by referencing your app name:
RedixClustered.get(:my_redis, "some-key")
RedixClustered.set(:my_redis, "some-key", "some-value")
# or if you left your cluster with name: nil
RedixCluster.get("some-key")
RedixCluster.set("some-key")
Or if you want to clone set commands to a 2nd redis cluster:
clone = [host: "127.0.0.2", port: 6380]
children = [
{RedixClustered, host: "127.0.0.1", port: 6379, prefix: "anything", clone: clone}
]
License
Contributing
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request