3 ms·
Typically by using the id field of objects as cache key. Even some clients do this, which is nice, except if your objects aren’t unique by their ids. It can usu
by eurasiantiger 4y ago
Typically by using the id field of objects as cache key. Even some clients do this, which is nice, except if your objects aren’t unique by their ids. It can usually be configured, however.
- xthrowawayxx 4y agoHow though do they know the ID before the object is created (/ fetched from db)? Sounds like it's inferior to manually using a DataLoader within every resolver that fetches an object. eg project has a client. In the resolver for a projects client, you fetch the client from DB. With DataLoader you manually cache the request for the client. With in-built caching you must resolve the client for the server to know the ID, and then on next resolve of the client, after fetching, it matches the ID and doesn't have to resolve it's fields again, but it still had to fetch both times?
- eurasiantiger 4y agoWell, how could they cache something they haven’t fetched?