v0.3.0
v0.3.0 includes:
NewResultMap
constructor accepts a int capacity rather than keys array- Minimize Keys interface
- remove
Identifiers
andUniqueIdentifiers
methods Keys
method now returns a []interface{} after calling theRaw
method of
each key
- remove
- Check raw value of Key before adding to key store
- Add
LoadNoOp
to Strategy interface and implement for all strategies.
LoadNoOp
is called when the dataloader returns the requested result from the
cache.LoadNoOp
should increment the loads counter and not return anything. - Update
Cache
interface to includeDelete
andClearAll
which return a
boolean.Cache
interface should also thread context through the methods. - Remove unused struct fields
- Remove mutex from key store. Keys are added to the key store in a single
worker go routine therefore concurrent access under normal use is not
possible. - Remove mutex from
Counter
. Counter will no longer be updated from multiple
go routines. - Remove mutex from
ResultMap
as it will no longer be accessed in multiple go
routines. - Remove
MergeWith
method fromResultMap
as it a basic wrapper around a for
loop. - Update strategy and dataloader to return callback functions (
Thunk
and
ThunkMany
). Returning callback functions allowLoad/LoadMany
to be called
without blocking but still trigger a worker go routine which can trigger the
batch function if capacity is hit. Results can then be fetched from after
calling the returned callbacks. - Implement
Once
strategy whose purpose is to wrap around calls to the batch
function or to trigger a background worker to call the batch function. This
allows for a consistent api throughout projects using the dataloader if a single
use dataloader is useful. - Fix race conditions in strategies.
- add tests.