abstract class GraphQL::DataLoader::Loader(O, K, V)
- GraphQL::DataLoader::Loader(O, K, V)
- Reference
- Object
Overview
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
.
Defined in:
graphql-dataloader/loader.crConstant Summary
-
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.
Instance Method Summary
- #clear(object : O) : self
- #clear : self
-
#key_for(object : O) : K
Get the key for an object passed to
#load
. -
#load(objects : Array(O)) : Array(V)
Load multiple values at once.
-
#load(object : O) : V
Load a value for an object.
- #prime(object : O, value : V) : self
Constructor Detail
You can use a custom cache by implementing Cache(K, V)
and passing it here.