Cruz
How to implement caching on an Absinthe based solution?
Hello Everyone,
I’ve learned that I can use ETS tables as a basic cache mechanism to expedite data queries in Elixir and Phoenix. And, other more advanced solutions (CacheX, ConCache) use ETS under the hood. However, what about if I’m using Absinthe to build a GraphQL API? None of the tutorials I’ve seen talk about caching. They just show you how to connect Absinthe to Ecto and a database.
Is there a way to tell Absinthe to read from ETS, or another cache? Should I use one of Absinthe plugins to help me with that?
Please notice that I’d like to be able to load specific data in memory. So, even if Absinthe has some kind of internal cache, that won’t help in this case.
Thank you
Marked As Solved
idi527
![]()
I’d probably load from cache in the resolver and/or in the “context”. I’m not sure it would be any different if there wasn’t absinthe/graphql. Dataloader could also probably be used with a (maybe custom) cache “source”.
Last Post!
Cruz
That is what I was thinking when I mentioned plugins before. Especially Dataloader.KV seems like a perfect match for ETS, but after recognizing resolvers can read from cache as well, that seems like an easier solution
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









