lib/graphql/batch/loader.rb in graphql-batch-0.5.1 vs lib/graphql/batch/loader.rb in graphql-batch-0.5.2

- old
+ new

@@ -42,9 +42,16 @@ end end attr_accessor :loader_key, :executor + def initialize + @loader_key = nil + @executor = nil + @queue = nil + @cache = nil + end + def load(key) cache[cache_key(key)] ||= begin queue << key ::Promise.new.tap { |promise| promise.source = self } end