如何创建带有到期日期的 Etag

发布于 2024-11-27 19:34:13 字数 369 浏览 5 评论 0原文

我正在考虑创建一个带有过期日期的 etag。

实际上,我创建了一个带有大量参数的 etag,但我想为其设置一个过期日期。

我有将信息保存在服务器端的解决方案,但我更喜欢将任何信息编码到其中。

我正在寻找更好的方法来做到这一点。

def etag_max_age(hash_code, max_age=30):
  # do something...
  return etag_with_max_age

def etag_max_age_expired(etag):
  # do some verifications
  return True or False

我正在考虑使用 cookie 的解决方案

I'm thinking about create an etag with an expire date.

Actually I create an etag with a large number of parameters but I would like to make it with an expire date.

I have the solution to keep an information in the server side but I prefer to encode any information into.

I'm searching the better way to do that.

def etag_max_age(hash_code, max_age=30):
  # do something...
  return etag_with_max_age

def etag_max_age_expired(etag):
  # do some verifications
  return True or False

I'm thinking about a solution with cookie

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

奢欲 2024-12-04 19:34:13

我对这个问题的解决方案是以hash-timestamp的形式在etag的末尾添加一个时间戳。然后您可以在需要时解析它。

My solution to the problem would be to add a timestamp to the end of the etag in the form of hash-timestamp. You could then parse that out when you needed it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文