DmitryTsepelev / graphql-ruby-persisted_queries

Persisted queries for graphql-ruby
MIT License
172 stars 20 forks source link

Adapter for Redis-backed in-memory store #23

Closed bmorton closed 4 years ago

bmorton commented 4 years ago

As discussed in #20, this PR introduces a new store adapter: RedisWithLocalCacheStoreAdapter

Since the in-memory storage adapter has the drawback of each node populating it's own cache and the Redis storage adapter requires remote calls over the network, this RedisWithLocalCacheStoreAdapter takes a hybrid approach that keeps an in-memory cache fresh while delegating cache misses to the Redis adapter for in-memory population. This allows us to force clients into the "new query path" less frequently and avoids unnecessary remote network calls.

With the assumption that hashes always resolve to the same query, no invalidation is needed for the in-memory stores.