subgrounds icon indicating copy to clipboard operation
subgrounds copied to clipboard

Add caching option

Open gabrielfior opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. I'm always frustrated when I have to do repeated subgraph calls for the same data.

Describe the solution you'd like I want to pass in an httpx client (for ex, hishel) and have it handle caching for me.

Describe alternatives you've considered I've considered implementing my own caching solution instead of doing a subgraph call - but this should actually be handled on a subgrounds package level (in my personal opinion).

gabrielfior avatar Nov 07 '24 17:11 gabrielfior

Hey @gabrielfior, you can do subgraph schema level caching via Subgrounds.schema_cache (defaults to "schemas/") and you can enable that via the save_schema parameter, Subgrounds.load_subgraph(URL, save_schema=True).

In terms of caching actual subgraph data, you can create your own custom client where you can implement this behavior. I recommend you take a look at the current Subgrounds and AsyncSubgrounds classes to get an idea of how this wraps the internal structures. Could be an interesting custom client!

0xMochan avatar Dec 01 '24 23:12 0xMochan