localStorage和锁定 [英] localStorage and locking
问题描述
由于(html5)localStorage及其等效项持续存在于选项卡和窗口之间,因此我考虑过将其用于消息传递.问题在于,获取和存储是不同的操作,因此不是原子操作.我有依赖于UUID生成,冲突解决和信标的模型来完成我需要做的一小部分工作,但是我真正的问题是:
Since (html5) localStorage and its equivalencies persist in between tabs and windows, I've thought about using it for message passing. The problem is that fetch and store are different operations, and therefore not atomic. I have models that rely on UUID generation, conflict resolutions, and beaconing to do the small subset of what I need to do, but my real question is this:
由于本地存储是共享内存资源,因此可用于相互访问的锁定机制是什么?
Since the local storage is a shared memory resource, what are the locking mechanisms available for mutual access?
推荐答案
I think what you really need is Channel Messaging, though as far as I'm aware no-one has implemented it yet. It allows arbitrary client side messaging between scripts.
这篇关于localStorage和锁定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!