Skip to content

Commit eb88bc0

Browse files
committed
Improve multi-level adapter
1 parent a610be1 commit eb88bc0

File tree

7 files changed

+410
-187
lines changed

7 files changed

+410
-187
lines changed

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
# Changelog
22

3+
## [v3.0.0-rc.2](https://github.com/elixir-nebulex/nebulex_distributed/tree/v3.0.0-rc.2) (2025-11-30)
4+
> [Full Changelog](https://github.com/elixir-nebulex/nebulex_distributed/compare/v3.0.0-rc.1...v3.0.0-rc.2)
5+
6+
### Enhancements
7+
8+
- [Nebulex.Adapters.Partitioned] Improved documentation with comprehensive
9+
sections on consistent hashing, key distribution, and cluster membership
10+
management.
11+
- [Nebulex.Adapters.Multilevel] Added comprehensive "How Multi-Level Caches Work"
12+
section covering cache lookup, write-through policy, replication modes, and
13+
TTL handling. Additionally, a "Near cache topology example" section with
14+
practical L1 (Local) + L2 (Redis) configuration and usage was added.
15+
- [Nebulex.Adapters.Multilevel.Options] Improved documentation for the supported
16+
options.
17+
18+
### Backwards incompatible changes
19+
20+
- [Nebulex.Adapters.Partitioned] The `Nebulex.Adapters.Partitioned.Bootstraper`
21+
module has been renamed to `Nebulex.Adapters.Partitioned.RingMonitor` to
22+
better reflect its monitoring responsibilities.
23+
- [Nebulex.Adapters.Partitioned.Options] The `:join_timeout` option has been
24+
renamed to `:rejoin_interval` for clarity. It represents the periodic interval
25+
at which the ring monitor rejoins the cluster group to force ring
26+
synchronization.
27+
28+
### Fixed
29+
30+
- Fixed typo in README.md ("GtiHub" → "GitHub").
31+
332
## [v3.0.0-rc.1](https://github.com/elixir-nebulex/nebulex_distributed/tree/v3.0.0-rc.1) (2025-06-07)
433
> [Full Changelog](https://github.com/elixir-nebulex/nebulex_distributed/compare/2c6188ebb9a482cd75a97b6abdb2feddcfb189c9...v3.0.0-rc.1)
534

README.md

Lines changed: 1 addition & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -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

14949
Since this adapter uses support modules and shared tests from `Nebulex`,
@@ -157,7 +57,7 @@ to `nebulex`:
15757
export 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
16161
by running:
16262

16363
```

0 commit comments

Comments
 (0)