如何存储大量数据
我必须从API中获得 5MB JSON文件( https:/ /pi.sleeper.app/v1/players/nfl ),但是由于他的尺寸需要一段时间,但是我只需要每天一次获得此文件。因此,我的问题是:有一种将此文件存储在我的应用中的方法,并且当我必须尝试使用ASYNC存储和一些使用相同逻辑的软件包时,请在我的应用中获取一些内容,但是<强>异步请求只需提取函数。
我想要的是以一种快速操纵这些数据的方式,而不是每次都需要我需要一些作品。
现在,我正在使用由我自己制作的API,该API占用此5MB文件并返回我需要的特定片段( https://teste-draft.netlify.app/.netlify/functions/getPlayersData?name = 167 )。但是,这个临时解决方案的问题是,当我必须获得很多播放器(例如20岁甚至更多的玩家)时,因为这么多请求,因此该应用程序最终需要很长时间才能显示数据。
I have to get a 5MB json file from an API (https://api.sleeper.app/v1/players/nfl), but because of his size the fetch take a while, but I just need to get this file once a day. So, my question is: theres a way to storage this file inside my app and get some piece when I have to? I've tried Async Storage and some others packages that uses the same logic, but the async request takes as long as the fetch function.
What I want is some way to manipulate this data in a fast way than if a have to fetch every single time that I need some piece.
Right now I'm using an API made by my own which takes this 5MB file and return the specific piece that I need (https://teste-draft.netlify.app/.netlify/functions/getplayersdata?name=167). But the problem with this temporary solution is when I have to get a lot of players (like 20 or even more), because it's so many requests that the app ends up taking a long time to display the data.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过创建一个上下文来存储所有5 MB数据,在用户打开应用程序时将获取这一点。这并不是我想要的,因为当用户关闭整个应用程序时,每次都可以运行。
I solved this by creating a Context to store all the 5 MB data, to be fetched when the user open the app. It was not exactly what I wanted, because the fetch run every time when the user close the entire app, but worked...