-
Notifications
You must be signed in to change notification settings - Fork 95
Description
I'm wondering if you have any thoughts on adding a method to DataLoader to support get-if-present semantics (could be called getIfPresent
, getIfCached
, getCachedValue
, etc.)
I have a use-case where there's an API that supports fetching either a partial or complete object. In my service, I have separate DataLoaders for these types of fetches. As you might expect, when I need to fetch the partial object I use the partial DataLoader, and when I need to fetch the full object I use the other DataLoader. However, if I've already fetched the full object then theoretically I can use that cached result to satisfy any subsequent partial fetches that come in. To support this, I want the partial DataLoader to first do a get-if-present on the complete DataLoader (without triggering a load)
Let me know if this use-case makes sense and if you would consider a PR that implements it