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

Cache query results #518

Open
tigerjack opened this issue Oct 5, 2023 · 7 comments
Open

Cache query results #518

tigerjack opened this issue Oct 5, 2023 · 7 comments

Comments

@tigerjack
Copy link

What feature would you like to request?
It would be great to have a cache of the results, similarly to what pybliometrics is already doing.

@arunkannawadi
Copy link
Collaborator

Could you expand a bit more on the use case? Are you suggesting that if you repeat a query, scholarly should return cached results instead of running the query again, or if a query returns results that have been previously returned from a different query (and filled say), it should fill the information from the cached results?

@tigerjack
Copy link
Author

Could you expand a bit more on the use case? Are you suggesting that if you repeat a query, scholarly should return cached results instead of running the query again, or if a query returns results that have been previously returned from a different query (and filled say), it should fill the information from the cached results?

I guess both of them are valid ideas, but the first seems more immediate. pybliometrics, for example, takes the results from the cache unless the user specifically force an update. I guess there's also an expire date for the cached results, but I am not sure about it.

For the use case, even testing some user scripts often requires a lot of time, since the results should be fetched every time from the web.

@arunkannawadi
Copy link
Collaborator

OK, having something like a 24-hour expiration for cached results would make sense. I don't have a timeline for this feature, but would welcome a PR from the community.

@ltalirz
Copy link

ltalirz commented Nov 26, 2023

It's actually very easy to do this with requests_cache (no changes needed in scholarly)

See the "patching" approach where requests_cache simply monkeypatches all calls to the requests library

https://requests-cache.readthedocs.io/en/stable/#patching

@anapaulagomes
Copy link

anapaulagomes commented Dec 7, 2023

I did this @ltalirz but it didn't work. The cache is installed but no URLs are returned. Did you try this out or have an example to show? Thank you!

Update: I just saw where the requests are happening :)

@ltalirz
Copy link

ltalirz commented Dec 7, 2023

Cheers, so it does work for you as well?

@anapaulagomes
Copy link

No, it doesn’t. I haven’t look further

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants