如何创建带有到期日期的 Etag
我正在考虑创建一个带有过期日期的 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对这个问题的解决方案是以
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.