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

Regression on decorated functions and Elixir 1.16 #216

Closed
GRoguelon opened this issue Dec 29, 2023 · 3 comments
Closed

Regression on decorated functions and Elixir 1.16 #216

GRoguelon opened this issue Dec 29, 2023 · 3 comments

Comments

@GRoguelon
Copy link

Hi,

I've updated few applications to Elixir 1.16.0 and found an issue with Nebulex and decorated functions.

If you take the following example:

@decorate cacheable(
            cache: NebulexDecoratedKeys.Cache,
            keys: [name],
            opts: [ttl: :timer.minutes(15)]
          )
def hello(name) do
  "Hello, #{name}!"
end

The option keys is not respected. The first time you call the function, the return value is as expected but if you call a second time the function with a different name , it will return the previous value instead of the correct one.

I've made a minimal project to demonstrate the issue. The instructions to reproduce the bug are in the README.md.

@cabol
Copy link
Owner

cabol commented Dec 29, 2023

Hi.

Keep in mind the option :keys is not available for the cacheable decorator (it is only allowed on cache_evict and cache_put decorators), then, it is being ignored in your example. You have to use the option :key instead. You can check the docs: https://hexdocs.pm/nebulex/Nebulex.Caching.Decorators.html#cacheable/3-options.

@GRoguelon
Copy link
Author

HI @cabol,

I just read the document and I wrongly used keys for months. Weird though that it breaks only now with a new version of Elixir.

I will adjust my code, thank you for your prompt reply and thank you for this great package, very handy!

@cabol
Copy link
Owner

cabol commented Dec 30, 2023

Hi @GRoguelon !!

I just read the document and I wrongly used keys for months. Weird though that it breaks only now with a new version of Elixir.

Yeah, it is weird, will take a look.

I will adjust my code, thank you for your prompt reply and thank you for this great package, very handy!

Thanks 🙇

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

No branches or pull requests

2 participants