@@ -44,106 +44,6 @@ See the [online documentation][online_docs] for more information.
4444
4545[ online_docs ] : http://hexdocs.pm/nebulex_distributed
4646
47- ## Partitioned cache topology example
48-
49- You can define a partitioned cache as follows:
50-
51- ``` elixir
52- defmodule MyApp .PartitionedCache do
53- use Nebulex .Cache ,
54- otp_app: :my_app ,
55- adapter: Nebulex .Adapters .Partitioned
56- end
57- ```
58-
59- Where the configuration for the cache must be in your application
60- environment, usually defined in your ` config/config.exs ` :
61-
62- ``` elixir
63- config :my_app , MyApp .PartitionedCache ,
64- primary: [
65- gc_interval: :timer .hours (12 ),
66- gc_memory_check_interval: :timer .seconds (10 ),
67- max_size: 1_000_000 ,
68- allocated_memory: 2_000_000_000
69- ]
70- ```
71-
72- If your application was generated with a supervisor (by passing ` --sup `
73- to ` mix new ` ) you will have a ` lib/my_app/application.ex ` file containing
74- the application start callback that defines and starts your supervisor.
75- You just need to edit the ` start/2 ` function to start the cache as a
76- supervisor on your application's supervisor:
77-
78- ``` elixir
79- def start (_type , _args ) do
80- children = [
81- {MyApp .PartitionedCache , []},
82- ]
83-
84- .. .
85- end
86- ```
87-
88- ## Near cache topology example
89-
90- To set up a near cache, you use the multilevel adapter, like so:
91-
92- ``` elixir
93- defmodule MyApp .Multilevel do
94- use Nebulex .Cache ,
95- otp_app: :nebulex ,
96- adapter: Nebulex .Adapters .Multilevel
97-
98- defmodule L1 do
99- use Nebulex .Cache ,
100- otp_app: :nebulex ,
101- adapter: Nebulex .Adapters .Local
102- end
103-
104- defmodule L2 do
105- use Nebulex .Cache ,
106- otp_app: :nebulex ,
107- adapter: Nebulex .Adapters .Partitioned
108- end
109- end
110- ```
111-
112- Where the configuration for the cache and its levels must be in your
113- application environment, usually defined in your ` config/config.exs ` :
114-
115- ``` elixir
116- config :my_app , MyApp .Multilevel ,
117- levels: [
118- {
119- MyApp .Multilevel .L1 ,
120- gc_interval: :timer .hours (12 ),
121- backend: :shards
122- },
123- {
124- MyApp .Multilevel .L2 ,
125- primary: [
126- gc_interval: :timer .hours (12 ),
127- backend: :shards
128- ]
129- }
130- ]
131- ```
132-
133- If your application was generated with a supervisor (by passing ` --sup `
134- to ` mix new ` ) you will have a ` lib/my_app/application.ex ` file containing
135- the application start callback that defines and starts your supervisor.
136- You just need to edit the ` start/2 ` function to start the cache as a
137- supervisor on your application's supervisor:
138-
139- ``` elixir
140- def start (_type , _args ) do
141- children = [
142- {MyApp .Multilevel , []},
143- .. .
144- ]
145- ```
146-
14747## Testing
14848
14949Since this adapter uses support modules and shared tests from ` Nebulex ` ,
@@ -157,7 +57,7 @@ to `nebulex`:
15757export NEBULEX_PATH=nebulex
15858```
15959
160- Second, make sure you fetch ` :nebulex ` dependency directly from GtiHub
60+ Second, make sure you fetch ` :nebulex ` dependency directly from GitHub
16161by running:
16262
16363```
0 commit comments