简体   繁体   English

session存储和粘性会话

[英]sessionStorage and sticky sessions

I was looking for some clarification really. 我真的在寻找一些澄清。 Looking at the W3Schools documentation on localStorage and sessionStorage , they write: 查看关于localStoragesessionStorageW3Schools文档,他们写道:

Local storage is per origin (per domain and protocol). 本地存储按来源(按域和协议)进行。 All pages, from one origin, can store and access the same data. 所有页面,从一个来源出发,都可以存储和访问相同的数据。

Does this mean that if I have multiple web front ends, and my load balancer is not using sticky sessions, that the data I store with the sessionStorage object may not be accessible, dependent upon which WFE serves the data? 这是否意味着如果我有多个Web前端,并且我的负载均衡器使用粘性会话,则取决于由哪个WFE提供数据,可能无法访问我与sessionStorage对象存储的数据?

Just a little unclear, and it's difficult to test. 只是有点不清楚,并且很难测试。 Many thanks! 非常感谢!

localStorage and sessionStorage are both stored in the browser , so your load balancer, sticky sessions, etc. will not affect these at all. localStoragesessionStorage都存储在浏览器中 ,因此您的负载均衡器,粘性会话等将完全不影响这些。 They may affect any data you store in the session on your server though. 但是,它们可能会影响您存储在服务器会话中的任何数据。

The difference between localStorage and sessionStorage is that sessionStorage is stored cleared when the page session ends, whereas localStorage has no expiration set. localStorage和sessionStorage之间的区别在于,在页面会话结束时会清除sessionStorage,而localStorage没有设置过期时间。

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

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