TheCocktailDB.com - An Open Cocktail Database with API
(2021-02-07, 22:55)docwra Wrote: No, you should never query an entire db at once it would be very inefficient and painfully slow for the user interface even with lazy loading.

Use the filters for ingredients and create category buttons in your app. Then list the cocktails to browse, then do another lookup on the ID once a user clicks on the cocktail for the details.
This is good advice in terms of huge databased, but in this case of this API, you can load the entire thing in about 2 seconds up-front as the app is starting, then never fire another network request for the life of the app (except to cache images).

What I do is do a load on first-start, save that to disk, and then load the cached data on startup next time, refreshing the db in the background after app has started up.  Gives a really awesome UX as there is no perceptible load time, it works well offline, search is instant etc.

If you want to take it further, you can pretty easily embed a cached version of the db right in the app itself, compressed the entire db is about 42kb.
Reply


Messages In This Thread
RE: TheCocktailDB.com - An Open Cocktail Database with API - by sblais - 2022-01-30, 11:20
Logout Mark Read Team Forum Stats Members Help
TheCocktailDB.com - An Open Cocktail Database with API2