Closed VesterDe closed 6 years ago
I'm working on this now. How many of the past kitties do think would be a good idea to store? I think if you stored all of them that would be bad once you start getting to 20k+. I was thinking keeping the 1000 most recent.
Ah, didn't see your comment till I already made the pull request :) That's a good question.
localStorage is tricky because you can only save key value pairs, no objects. My solution was to JSON.stringify it, but keeping tabs on how many you have stored would mean searching through the localStorage keys for the pattern kitty-{id} and deleting it based on the cache age, I guess?
I think I have a nice solution that has two tables. One that always stores your own kitties and one that stores the 1000 most recent.
That seems logical. Looking forward to seeing something, the site is less and less accessible it seems :)
Uploaded new version please let me know how it goes. Was a little hard to test with how slow the site was.
Nice! Seems to be working well for me. I ran it across my 10 cats and it grabbed data for 3 of them. The others timed out due to network load. Then I reloaded the page and ran it across all 10 again -- and those 3 immediately popped up -- and the others started trying to grab data again.
So, the caching seems to work -- and really makes a difference in relieving some load. Thanks!
Thanks. I will add a failure indicator next @jgoggan
Looks like everything is good now 👍
How to access to API, is it document?
Thanks
I've noticed the cryptokitties api is degrading in performance (or is it just me, in central Europe?). I doubt it's because of this addon, but still.
Perhaps the addon could store the results of past api calls in localstorage, as a service to the nice people developing cryptokitties (who probably haven't slept for a few days now). It would also improve user experience a great deal.