Skip to content

Commit

Permalink
[#189] Nebulex v3 initial draft
Browse files Browse the repository at this point in the history
- Ok/Error tuple Cache API.
- Remove deprecated module `Nebulex.Hook`.
- Use `NimbleOptions` for defining and validating cache options.
- Move adapters to separate repos.
- All commands optionally support a dynamic cache as the first argument.
- Deprecate `Nebulex.Adapter.Stats` in favor of `Nebulex.Adapter.Info`.
- Rename the Telemetry metadata field from `:function_name` to `:command`.
- Support dynamic cache in decorators.
- Evaluate the `:cache` option for decorated functions in runtime.
- Changes and improvements on Decorator API.
- Telemetry events for cache commands out-of-box.
  • Loading branch information
cabol committed Aug 12, 2023
1 parent b14b47c commit 2122f5d
Show file tree
Hide file tree
Showing 123 changed files with 8,301 additions and 12,702 deletions.
4 changes: 2 additions & 2 deletions .credo.exs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@
## Refactoring Opportunities
#
{Credo.Check.Refactor.CondStatements, []},
{Credo.Check.Refactor.CyclomaticComplexity, []},
{Credo.Check.Refactor.CyclomaticComplexity, [max_complexity: 40]},
{Credo.Check.Refactor.FunctionArity, []},
{Credo.Check.Refactor.LongQuoteBlocks, [max_line_count: 300, ignore_comments: true]},
{Credo.Check.Refactor.LongQuoteBlocks, [max_line_count: 200]},
# {Credo.Check.Refactor.MapInto, []},
{Credo.Check.Refactor.MatchInCondition, []},
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
Expand Down
6 changes: 0 additions & 6 deletions .dialyzer_ignore.exs

This file was deleted.

20 changes: 20 additions & 0 deletions .doctor.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
%Doctor.Config{
ignore_modules: [
Nebulex.Cache.Impl,
Nebulex.Cache.Options,
Nebulex.Caching.Options,
Nebulex.Dialyzer.CachingDecorators
],
ignore_paths: [],
min_module_doc_coverage: 40,
min_module_spec_coverage: 0,
min_overall_doc_coverage: 80,
min_overall_moduledoc_coverage: 100,
min_overall_spec_coverage: 0,
exception_moduledoc_required: true,
raise: false,
reporter: Doctor.Reporters.Full,
struct_type_spec_required: true,
umbrella: false,
failed: false
}
16 changes: 16 additions & 0 deletions .formatter.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
locals_without_parens = [
# Nebulex.Utils
unwrap_or_raise: 1,
wrap_ok: 1,
wrap_error: 1,
wrap_error: 2,

# Nebulex.Cache.Utils
defcacheapi: 2,

# Nebulex.Adapter
defcommand: 1,
defcommand: 2,
defcommandp: 1,
defcommandp: 2,

# Nebulex.Caching
dynamic_cache: 2,
keyref: 1,
keyref: 2,

Expand Down
33 changes: 16 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,26 @@ jobs:
strategy:
matrix:
include:
- elixir: 1.14.x
- elixir: 1.15.x
otp: 26.x
os: 'ubuntu-latest'
- elixir: 1.15.x
otp: 25.x
os: 'ubuntu-latest'
style: true
coverage: true
sobelow: true
dialyzer: true
doctor: true
- elixir: 1.14.x
otp: 25.x
os: 'ubuntu-latest'
- elixir: 1.13.x
otp: 24.x
os: 'ubuntu-latest'
- elixir: 1.11.x
- elixir: 1.12.x
otp: 23.x
os: 'ubuntu-20.04'
inch-report: true
- elixir: 1.9.x
otp: 22.x
os: 'ubuntu-20.04'

env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
Expand Down Expand Up @@ -87,27 +90,23 @@ jobs:
if: ${{ matrix.style }}

- name: Run tests
run: |
epmd -daemon
mix test --trace
run: mix test
if: ${{ !matrix.coverage }}

- name: Run tests with coverage
run: |
epmd -daemon
mix coveralls.github
run: mix coveralls.github
if: ${{ matrix.coverage }}

- name: Run sobelow
run: mix sobelow --exit --skip
run: mix sobelow --skip --exit Low
if: ${{ matrix.sobelow }}

- name: Restore PLT Cache
uses: actions/cache@v3
id: plt-cache
with:
path: priv/plts
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plt-v1
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plt-v3-1
if: ${{ matrix.dialyzer }}

- name: Create PLTs
Expand All @@ -120,6 +119,6 @@ jobs:
run: mix dialyzer --format github
if: ${{ matrix.dialyzer && steps.plt-cache.outputs.cache-hit != 'true' }}

- name: Doc coverage report
run: MIX_ENV=docs mix inch.report
if: ${{ matrix.inch-report }}
- name: Run documentation health check
run: mix doctor
if: ${{ matrix.doctor }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ erl_crash.dump
/priv
.sobelow*
/config
Elixir*
132 changes: 0 additions & 132 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,138 +4,6 @@ All notable changes to this project will be documented in this file.

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v2.5.2](https://github.com/cabol/nebulex/tree/v2.5.2) (2023-07-14)

[Full Changelog](https://github.com/cabol/nebulex/compare/v2.5.1...v2.5.2)

**Closed issues:**

- Replicated adapter syncing during rolling deployment.
[#209](https://github.com/cabol/nebulex/issues/209)
- Ambiguity regarding ttl and `gc_interval` relation.
[#208](https://github.com/cabol/nebulex/issues/208)
- Seeing Nebulex.RPCError during deployments with partitioned adapter.
[#206](https://github.com/cabol/nebulex/issues/206)
- Random `:erpc`, `:timeout` with partitioned get.
[#202](https://github.com/cabol/nebulex/issues/202)
- Processes reading from cache blocked by generational gc process.
[#197](https://github.com/cabol/nebulex/issues/197)

**Merged pull requests:**

- Delay flushing ets table to avoid blocking processes using it.
[#210](https://github.com/cabol/nebulex/pull/210)
([szajbus](https://github.com/szajbus))

## [v2.5.1](https://github.com/cabol/nebulex/tree/v2.5.1) (2023-05-27)

[Full Changelog](https://github.com/cabol/nebulex/compare/v2.5.0...v2.5.1)

**Merged pull requests:**

- Fix `nil` check in `Nebulex.Adapters.Multilevel.get/3`
[#205](https://github.com/cabol/nebulex/pull/205)
([1100x1100](https://github.com/1100x1100))
- `mix nbx.gen.cache` example fixed
[#204](https://github.com/cabol/nebulex/pull/204)
([hissssst](https://github.com/hissssst))

## [v2.5.0](https://github.com/cabol/nebulex/tree/v2.5.0) (2023-05-13)

[Full Changelog](https://github.com/cabol/nebulex/compare/v2.4.2...v2.5.0)

**Implemented enhancements:**

- Support for functions that can set TTL in Decorator similar to Match
[#200](https://github.com/cabol/nebulex/issues/200)
- Improve default match function in decorators to cover more scenarios
[#177](https://github.com/cabol/nebulex/issues/177)
- Adapters implementation guide
[#96](https://github.com/cabol/nebulex/issues/96)

**Fixed bugs:**

- Issue with keys set to `false` when calling `get_all` in local adapter
[#187](https://github.com/cabol/nebulex/issues/187)

**Closed issues:**

- Is there any way to get the size of the cache?
[#203](https://github.com/cabol/nebulex/issues/203)
- Where to use load/2, dump/2
[#201](https://github.com/cabol/nebulex/issues/201)
- `Nebulex.Cache` callbacks mention "Shared Options" section that do not exist
[#199](https://github.com/cabol/nebulex/issues/199)
- Errors when storing nil values
[#195](https://github.com/cabol/nebulex/issues/195)
- Unregistering cache in registry happens after cache shuts down
[#194](https://github.com/cabol/nebulex/issues/194)
- Is there a good way to evict multiple caches at once by some conditions?
[#192](https://github.com/cabol/nebulex/issues/192)
- Unable to use module attributes when specifying a MFA cache within the decorator
[#191](https://github.com/cabol/nebulex/issues/191)
- Nebulex crash when `gc_interval` is not set
[#182](https://github.com/cabol/nebulex/issues/182)
- `ArgumentError` * 1st argument: the table identifier does not refer to an existing ETS table
[#181](https://github.com/cabol/nebulex/issues/181)
- Feedback for `NebulexLocalDistributedAdapter`
[#180](https://github.com/cabol/nebulex/issues/180)
- Multilevel invalidation
[#179](https://github.com/cabol/nebulex/issues/179)
- External cache-key references on `cacheable` decorator
[#178](https://github.com/cabol/nebulex/issues/178)
- [multiple clause functions] Cannot use ignored variables in decorator keys
[#173](https://github.com/cabol/nebulex/issues/173)
- Ability for referencing a key in the `cacheable` decorator via `:references` option
[#169](https://github.com/cabol/nebulex/issues/169)
- Multi level caching suggestion?
[#168](https://github.com/cabol/nebulex/issues/168)

**Merged pull requests:**

- Fix `Local.get_all` with false values
[#186](https://github.com/cabol/nebulex/pull/186)
([renatoaguiar](https://github.com/renatoaguiar))
- Add NebulexLocalMultilevelAdapter to the list
[#185](https://github.com/cabol/nebulex/pull/185)
([martosaur](https://github.com/martosaur))
- Fix the crash when `gc_interval` is not set
[#183](https://github.com/cabol/nebulex/pull/183)
([dongfuye](https://github.com/dongfuye))
- [#169] Reference a key in `cacheable` decorator via `:references` option
[#176](https://github.com/cabol/nebulex/pull/176)
([cabol](https://github.com/cabol))
- Creating New Adapter guide
[#175](https://github.com/cabol/nebulex/pull/175)
([martosaur](https://github.com/martosaur))

## [v2.4.2](https://github.com/cabol/nebulex/tree/v2.4.2) (2022-11-04)

[Full Changelog](https://github.com/cabol/nebulex/compare/v2.4.1...v2.4.2)

**Closed issues:**

- Adapter configuration per-env?
[#171](https://github.com/cabol/nebulex/issues/171)
- On-change handler for write-through decorators
[#165](https://github.com/cabol/nebulex/issues/165)
- Document test env setup with decorators?
[#155](https://github.com/cabol/nebulex/issues/155)
- Managing Failovers in the cluster
[#131](https://github.com/cabol/nebulex/issues/131)

**Merged pull requests:**

- Make Multilevel adapter apply deletes in reverse order
[#174](https://github.com/cabol/nebulex/pull/174)
([martosaur](https://github.com/martosaur))
- Use import Bitwise instead of use Bitwise
[#172](https://github.com/cabol/nebulex/pull/172)
([ryvasquez](https://github.com/ryvasquez))
- Fix result of getting value by non existent key
[#166](https://github.com/cabol/nebulex/pull/166)
([fuelen](https://github.com/fuelen))

## [v2.4.1](https://github.com/cabol/nebulex/tree/v2.4.1) (2022-07-10)

[Full Changelog](https://github.com/cabol/nebulex/compare/v2.4.0...v2.4.1)
Expand Down
Loading

0 comments on commit 2122f5d

Please sign in to comment.