重新等待键在get请求中缓存

发布于 2025-01-29 13:59:46 字数 243 浏览 5 评论 0原文

我有两个休息点的

  1. 发布请求,此请求执行一些长期运行的任务,并填充缓存中的键值对。
  2. 获取请求此获取与特定密钥相对应的缓存的数据。

现在,有时甚至在POST请求完成处理之前,Spring-Boot Server即将获得GET请求,因此我想要某种方式,以便Get请求等待键在服务器中加入。如果在1秒内,键不会从get终点返回缓存的null。

任何人都可以通过一些解决方案来帮助我解决这个问题。

I have two REST end-points

  1. POST request, this request does some long running task and fills the key-value pair in the cache.
  2. GET request this gets the data from the cache corresponding to a particular key.

Now sometimes Spring-boot server gets the GET request even before the post request has finished processing, so I want some way such that the GET request waits for the key to get cached in the server. If within 1-second the key does not get cached null is returned from the GET end point.

Can anyone please help me with some solution or a way to solve this problem.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文