class

GraphQL::DataLoader::Loader(O, K, V)

Inherits Reference < Object

Abstract base class for all loaders

The first type parameter O is the type of the objects passed to #load. The second type parameter K is the type of keys for caching and determining uniqueness. The third type parameter V is the type of values returned by the loader.

You will need to override fetch to provide the actual batch loading behavior. If O differs from K you will also need to override #key_for.

Constants

VERSION = "0.1.0"

Constructors

new(cache : GraphQL::DataLoader::Cache(K, V) = MemoryCache(K, V).new)

You can use a custom cache by implementing Cache(K, V) and passing it here.

Source

Instance methods

clear(object : O) : self
Source
clear
Source
key_for(object : O) : K

Get the key for an object passed to #load. Override this if O differs from K

Source
load(objects : Array(O)) : Array(V)

Load multiple values at once.

Source
load(object : O) : V

Load a value for an object.

Source
prime(object : O, value : V) : self
Source