Reputation: 2031
Phoenix framework is just like rails. But rails provide a cache solution: Rails.cache
.
Is the any similar feature in Phoenix framework? Or caching is different in Elixir?
Upvotes: 2
Views: 3294
Reputation: 17721
Use Cachex:
result = %{a => 1}
Cachex.set(:apicache, "ajax" , result, [ ttl: :timer.seconds(1800)])
Cachex.get(:apicache, "ajax")
Upvotes: 2
Reputation: 15343
I don't think there's a cache specifically for Phoenix; however I'm not as expert on Phoenix as I am on other aspects of Elixir. That said there is this: https://github.com/sasa1977/con_cache
Normally if I were wanting a cache for any Elixir app I'd check https://hex.pm first.
Upvotes: 2