graph-gophers / dataloader

Implementation of Facebook's DataLoader in Golang
MIT License
1.2k stars 75 forks source link

Support cache skipping for `Load()` calls that throw `SkipCacheError` #111

Open goncalvesnelson opened 4 months ago

goncalvesnelson commented 4 months ago

Currently, when using a dataloader with a cache, errors returned by theBatchFunc are stored in the cache. A user should be able to decide on caching errors depending on the error type (e.g. temporary errors when using caches with long ttl). To support this use case, this PR adds a new error type SkipCacheError along with the NewSkipCacheError constructor function to allow users to wrap errors they don't want to be cached.