diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ee6cbb..51ffc2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 0.4.9 + +## Performance + +- perf(sandbox): make `Cache.SandboxRegistry.register_caches/2` post-register sleep configurable via `Cache.Config.sandbox_sleep_ms/0` (`config :elixir_cache, :sandbox_sleep_ms, 50`). Default is unchanged (50 ms). Test suites that don't need the sleep can set it to `0` in `config/test.exs` to save ~50 ms per cache registered per test — material on apps with many cache modules. + # 0.4.8 ## Bug Fixes diff --git a/lib/cache/config.ex b/lib/cache/config.ex new file mode 100644 index 0000000..c73c30a --- /dev/null +++ b/lib/cache/config.ex @@ -0,0 +1,9 @@ +defmodule Cache.Config do + @moduledoc false + + @app :elixir_cache + + def sandbox_sleep_ms do + Application.get_env(@app, :sandbox_sleep_ms, 50) + end +end diff --git a/lib/cache/sandbox_registry.ex b/lib/cache/sandbox_registry.ex index fe57f29..5674213 100644 --- a/lib/cache/sandbox_registry.ex +++ b/lib/cache/sandbox_registry.ex @@ -5,7 +5,6 @@ defmodule Cache.SandboxRegistry do More details soon... """ - @sleep_for_sync 50 @registry :elixir_cache_sandbox @keys :duplicate @@ -38,7 +37,7 @@ defmodule Cache.SandboxRegistry do {:error, :registry_not_started} -> raise_not_started!() end - Process.sleep(@sleep_for_sync) + Process.sleep(Cache.Config.sandbox_sleep_ms()) res end diff --git a/mix.exs b/mix.exs index 618d38e..6f638d0 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule ElixirCache.MixProject do def project do [ app: :elixir_cache, - version: "0.4.8", + version: "0.4.9", elixir: "~> 1.11", start_permanent: Mix.env() == :prod, description: