Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add caching option #60

Open
gabrielfior opened this issue Nov 7, 2024 · 1 comment
Open

Add caching option #60

gabrielfior opened this issue Nov 7, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@gabrielfior
Copy link
Contributor

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 gabrielfior added the enhancement New feature or request label Nov 7, 2024
@0xMochan
Copy link
Collaborator

0xMochan commented Dec 1, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants