Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing dynamic cache configuration to the decorators #156

Merged
merged 1 commit into from
Jun 1, 2022

Conversation

suzdalnitski
Copy link
Contributor

@suzdalnitski suzdalnitski commented May 16, 2022

This PR enables dynamic cache configuration with decorators:

defmodule MyApp.AccountService do
  @decorate cacheable(cache: {MyApp.AccountService, :get_cache, []}, key: id)
  def get_account(id), do: ...

  @decorate cache_put(cache: {MyApp.AccountService, :get_cache, []}, key: account.id)
  def update_account(account), do: ...

  def get_cache, do: Application.fetch_env!(:my_app, :cache)
end

@suzdalnitski suzdalnitski changed the title feature: allow passing dynamic cache configuration to the decorators Allow passing dynamic cache configuration to the decorators May 17, 2022
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 1c0cca2 on hiivemarkets:dynamic-cache-decorator into 530fa4d on cabol:master.

@cabol
Copy link
Owner

cabol commented Jun 1, 2022

@suzdalnitski the dialyzer is failing, I think I know why, but that will require some changes, so, since the PR looks overall good to me, I will merge it for now, and will push some improvements and the dialyzer fix later (very soon).

@cabol cabol merged commit 20f2c04 into cabol:master Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants