lib/graphql/dataloader.rb in graphql-2.1.0 vs lib/graphql/dataloader.rb in graphql-2.1.1
- old
+ new
@@ -102,9 +102,18 @@
# (If the dataloader is already running, than a Fiber will pick this up later.)
@pending_jobs.push(job)
nil
end
+ # Clear any already-loaded objects from {Source} caches
+ # @return [void]
+ def clear_cache
+ @source_cache.each do |_source_class, batched_sources|
+ batched_sources.each_value(&:clear_cache)
+ end
+ nil
+ end
+
# Use a self-contained queue for the work in the block.
def run_isolated
prev_queue = @pending_jobs
prev_pending_keys = {}
@source_cache.each do |source_class, batched_sources|