简体   繁体   English

捆绑不同客户端的相似REST API请求

[英]Bundle similar REST API requests of different clients

I'm currently working with an REST API interface and want to reduce my network stress and data accessibility by bundling incoming requests from multiple clients to avoid requesting the same informations.我目前正在使用 REST API 接口,并希望通过捆绑来自多个客户端的传入请求来减少我的网络压力和数据可访问性,以避免请求相同的信息。 So I need to bundle my individuals requests, call them with an broker like application and respond only the required information to the specific clients.因此,我需要捆绑我的个人请求,使用类似应用程序的代理调用它们,并仅向特定客户端响应所需的信息。

I thought about wrapping a Graphql implementation around my REST API but it seems to be bit of an overkill.我想过在我的 REST API 周围包装一个 Graphql 实现,但这似乎有点矫枉过正。 Are there any other workarounds (other than using a cache due to licensing problems) to fulfill the criteria of my use case?是否有其他解决方法(除了由于许可问题使用缓存)来满足我的用例标准?

If you don't want any complex, you can implement your custom solution with a simple API service that keep a cache of requested data.如果您不想要任何复杂的东西,您可以使用一个简单的 API 服务来实现您的自定义解决方案,该服务保留请求数据的缓存。 Each time that a request come, the copy (if exists, if not a new one must be done) is returned and after the original source will be requested to check if a data refresh is required.每次请求到来时,都会返回副本(如果存在,如果不存在,则必须完成一个新的副本),并在请求原始源之后检查是否需要刷新数据。

Also, you can save some statistic values as cache requires number, consume times, etc. It can be help you without much effort and you can use some fast key-value database engines to build that as leveldb , for example.此外,您可以保存一些统计值,因为缓存需要数量、消耗次数等。它可以帮助您毫不费力,例如,您可以使用一些快速的键值数据库引擎将其构建为leveldb

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM