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

Caching? #25

Open
Krzysiu opened this issue Mar 6, 2024 · 0 comments
Open

Caching? #25

Krzysiu opened this issue Mar 6, 2024 · 0 comments

Comments

@Krzysiu
Copy link

Krzysiu commented Mar 6, 2024

Would be it possible to add save/load response feature? That could serve as caching system -for testing projects that needs a few (or way more) fetches, eventually to manually change data to test edge cases ("what my script will do if this field won't be filled on WD"). And even better for public scripts, with a lot of hits where author could easily cache data for certain time.

I imagine it something like:

if (file_exists('cache.txt') $wikidata->loadString(file_get_contents('cache.txt')); // and loadFile('cache.txt')? That would be rad
else { $wikidata->get('Q12345'); file_put_contents('cache.txt', $wikidata->rawResponse); }

So an additional property, which is filled upon get() method and can be populated with loadString() method (and then processed, as it would be response from curl). Optionally (because one can keep track of it by oneself, not relying on class), a property source to display curl, string or file (in case f proposed loadFile())

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

No branches or pull requests

1 participant