1- # NebulexRedisAdapter
1+ # Nebulex.Adapters.Redis
22> Nebulex adapter for Redis (including [ Redis Cluster] [ redis_cluster ] support).
33
44![ CI] ( https://github.com/cabol/nebulex_redis_adapter/workflows/CI/badge.svg )
@@ -15,7 +15,7 @@ next sections.
1515See also [ online documentation] [ nbx_redis_adapter ]
1616and [ Redis cache example] [ nbx_redis_example ] .
1717
18- [ nbx_redis_adapter ] : http://hexdocs.pm/nebulex_redis_adapter/NebulexRedisAdapter .html
18+ [ nbx_redis_adapter ] : http://hexdocs.pm/nebulex_redis_adapter/Nebulex.Adapters.Redis .html
1919[ nbx_redis_example ] : https://github.com/cabol/nebulex_examples/tree/master/redis_cache
2020[ redis_cluster ] : https://redis.io/topics/cluster-tutorial
2121
@@ -51,7 +51,7 @@ After installing, we can define our cache to use Redis adapter as follows:
5151defmodule MyApp .RedisCache do
5252 use Nebulex .Cache ,
5353 otp_app: :my_app ,
54- adapter: NebulexRedisAdapter
54+ adapter: Nebulex . Adapters . Redis
5555end
5656```
5757
@@ -69,15 +69,15 @@ config :my_app, MyApp.RedisCache,
6969
7070Since this adapter is implemented by means of ` Redix ` , it inherits the same
7171options, including regular Redis options and connection options as well. For
72- more information about the options, please check out ` NebulexRedisAdapter `
72+ more information about the options, please check out ` Nebulex.Adapters.Redis `
7373module and also [ Redix] ( https://github.com/whatyouhide/redix ) .
7474
7575See also [ Redis cache example] [ nbx_redis_example ] .
7676
7777## Distributed Caching
7878
7979There are different ways to support distributed caching when using
80- ** NebulexRedisAdapter ** .
80+ ** Nebulex.Adapters.Redis ** .
8181
8282### Redis Cluster
8383
@@ -95,7 +95,7 @@ Then we can define our cache which will use **Redis Cluster**:
9595defmodule MyApp .RedisClusterCache do
9696 use Nebulex .Cache ,
9797 otp_app: :my_app ,
98- adapter: NebulexRedisAdapter
98+ adapter: Nebulex . Adapters . Redis
9999end
100100```
101101
@@ -127,11 +127,11 @@ The pool of connections to the different master nodes is automatically
127127configured by the adapter once it gets the cluster slots info.
128128
129129> This one could be the easiest and recommended way for distributed caching
130- using Redis and ** NebulexRedisAdapter ** .
130+ using Redis and ** Nebulex.Adapters.Redis ** .
131131
132132### Client-side Cluster based on Sharding
133133
134- ** NebulexRedisAdapter ** also brings with a simple client-side cluster
134+ ** Nebulex.Adapters.Redis ** also brings with a simple client-side cluster
135135implementation based on Sharding distribution model.
136136
137137We define our cache normally:
@@ -140,7 +140,7 @@ We define our cache normally:
140140defmodule MyApp .ClusteredCache do
141141 use Nebulex .Cache ,
142142 otp_app: :my_app ,
143- adapter: NebulexRedisAdapter
143+ adapter: Nebulex . Adapters . Redis
144144end
145145```
146146
@@ -182,9 +182,9 @@ config :my_app, MyApp.ClusteredCache,
182182 ]
183183```
184184
185- By default, the adapter uses ` NebulexRedisAdapter.ClientCluster. Keyslot` for the
186- keyslot. Besides, if ` :jchash ` is defined as dependency, the adapter will use
187- consistent-hashing automatically.
185+ By default, the adapter uses ` Nebulex.Adapters.Redis.ClientSideCluster. Keyslot`
186+ for the keyslot. Besides, if ` :jchash ` is defined as dependency, the adapter
187+ will use consistent-hashing automatically.
188188
189189> ** NOTE:** It is highly recommended to define the ` :jchash ` dependency
190190 when using the adapter in ` :client_side_cluster ` mode.
@@ -224,28 +224,28 @@ config :my_app, MyApp.ClusteredCache,
224224### Using ` Nebulex.Adapters.Partitioned `
225225
226226Another simple option is to use the ` Nebulex.Adapters.Partitioned ` and set as
227- local cache the ` NebulexRedisAdapter ` . The idea here is each Elixir node running
228- the distributed cache (` Nebulex.Adapters.Partitioned ` ) will have as local
229- backend or cache a Redis instance (handled by ` NebulexRedisAdapter ` ).
227+ local cache the ` Nebulex.Adapters.Redis ` . The idea here is each Elixir node
228+ running the distributed cache (` Nebulex.Adapters.Partitioned ` ) will have as
229+ local backend or cache a Redis instance (handled by ` Nebulex.Adapters.Redis ` ).
230230
231231
232232This example shows how the setup a distributed cache using
233- ` Nebulex.Adapters.Partitioned ` and ` NebulexRedisAdapter ` :
233+ ` Nebulex.Adapters.Partitioned ` and ` Nebulex.Adapters.Redis ` :
234234
235235``` elixir
236236defmodule MyApp .DistributedCache do
237237 use Nebulex .Cache ,
238238 otp_app: :my_app ,
239239 adapter: Nebulex .Adapters .Partitioned ,
240- primary_storage_adapter: NebulexRedisAdapter
240+ primary_storage_adapter: Nebulex . Adapters . Redis
241241end
242242```
243243
244244### Using a Redis Proxy
245245
246246The other option is to use a proxy, like [ Envoy proxy] [ envoy ] or
247247[ Twemproxy] [ twemproxy ] on top of Redis. In this case, the proxy does the
248- distribution work, and from the adparter's side (** NebulexRedisAdapter ** ),
248+ distribution work, and from the adparter's side (** Nebulex.Adapters.Redis ** ),
249249it would be only configuration. Instead of connect the adapter against the
250250Redis nodes, we connect it against the proxy nodes, this means, in the config,
251251we setup the pool with the host and port pointing to the proxy.
@@ -255,13 +255,13 @@ we setup the pool with the host and port pointing to the proxy.
255255
256256## Running Redis commands and/or pipelines
257257
258- Since ` NebulexRedisAdapter ` works on top of ` Redix ` and provides features like
259- connection pools and "Redis Cluster" support, it may be seen also as a sort of
260- Redis client, but it is meant to be used mainly with the Nebulex cache API.
261- However, Redis API is quite extensive and there are a lot of useful commands
262- we may want to run taking advantage of the ` NebulexRedisAdapter ` features.
263- Therefore, the adapter injects two additional/extended functions to the
264- defined cache: ` command!/2 ` and ` pipeline!/2 ` .
258+ Since ` Nebulex.Adapters.Redis ` works on top of ` Redix ` and provides features
259+ like connection pools and "Redis Cluster" support, it may be seen also as a
260+ sort of Redis client, but it is meant to be used mainly with the Nebulex cache
261+ API. However, Redis API is quite extensive and there are a lot of useful
262+ commands we may want to run taking advantage of the ` Nebulex.Adapters.Redis `
263+ features. Therefore, the adapter injects two additional/extended functions
264+ to the defined cache: ` command!/2 ` and ` pipeline!/2 ` .
265265
266266``` elixir
267267iex> MyCache .command! ([" LPUSH" , " mylist" , " world" ], key: " mylist" )
@@ -287,8 +287,8 @@ you have to pass the cache name explicitly.
287287
288288## Testing
289289
290- To run the ** NebulexRedisAdapter ** tests you will have to have Redis running
291- locally. ** NebulexRedisAdapter ** requires a complex setup for running tests
290+ To run the ** Nebulex.Adapters.Redis ** tests you will have to have Redis running
291+ locally. ** Nebulex.Adapters.Redis ** requires a complex setup for running tests
292292(since it needs a few instances running, for standalone, cluster and Redis
293293Cluster). For this reason, there is a [ docker-compose.yml] ( docker-compose.yml )
294294file in the repo so that you can use [ Docker] [ docker ] and
@@ -302,7 +302,7 @@ $ docker-compose up
302302[ docker ] : https://www.docker.com/
303303[ docker_compose ] : https://docs.docker.com/compose/
304304
305- Since ` NebulexRedisAdapter ` uses the support modules and shared tests
305+ Since ` Nebulex.Adapters.Redis ` uses the support modules and shared tests
306306from ` Nebulex ` and by default its test folder is not included in the Hex
307307dependency, the following steps are required for running the tests.
308308
@@ -373,4 +373,4 @@ all checks run successfully.
373373
374374Copyright (c) 2018, Carlos Bolaños.
375375
376- NebulexRedisAdapter source code is licensed under the [ MIT License] ( LICENSE ) .
376+ Nebulex.Adapters.Redis source code is licensed under the [ MIT License] ( LICENSE ) .
0 commit comments