whitfin / cachex

A powerful caching library for Elixir with support for transactions, fallbacks and expirations
https://hexdocs.pm/cachex/
MIT License
1.6k stars 103 forks source link

fix missing warmer macro by importing Cachex.Spec #298

Closed ejscunha closed 1 year ago

ejscunha commented 2 years ago

While testing the async warmer functionality in the upstream version, I noticed it was raising an error

** (CompileError) lib/cachex/warmer.ex:73: cannot find or invoke local warmer/1 inside match. Only macros can be invoked in a match and they must be defined before their invocation. Called as: warmer(async: async, state: state)

fixed it by adding import Cachex.Spec to lib/cachex/warmer.ex

whitfin commented 1 year ago

Hi @ejscunha !

Thanks, I don't really understand how this was never seen before (unless I'm missing something obvious here). Still, thank you for the PR!