whitfin / cachex

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

Migrate Hooks to live as GenServer and not GenEvent #71

Closed whitfin closed 8 years ago

whitfin commented 8 years ago

GenEvent really doesn't do much for us here, the Hooks operate more as GenServers. There's a fair bit of bloat to Hook setup because of this, so we should just fallback to using GenServer. In future, perhaps GenStage but servers will suffice for now.

We should be able to keep the same interface, but this is going in v2 just in case.

whitfin commented 8 years ago

Also decided that results should always be provided and there should no longer be an option. If there's a pre hook, it's just provided with nil. Post hooks will always receive the action result. Removes the special casing and option.