mega_mutex:使用Memcache的Ruby中的分布式互斥锁

时间:2021-05-22 15:34:05
【文件属性】:
文件名称:mega_mutex:使用Memcache的Ruby中的分布式互斥锁
文件大小:9KB
文件格式:ZIP
更新时间:2021-05-22 15:34:05
Ruby mega_mutex Ruby的分布式互斥量。 为什么 有时我需要这样做: unless enough_things? make_more_things end 如果我同时运行多个进程,则会出现竞争状况,这意味着其中两个进程都认为没有足够的东西。 因此,即使不需要,我们也可以做更多。 如何 假设您有一个ThingMaker: class ThingMaker include MegaMutex def ensure_just_enough_things with_distributed_mutex("ThingMaker Mutex ID") do unless enough_things? make_more_things end end end end 现在,由于有了MegaMutex的魔力,您可以确保所
【文件预览】:
mega_mutex-master
----VERSION(6B)
----History.txt(89B)
----.document(60B)
----lib()
--------mega_mutex.rb(3KB)
--------mega_mutex()
----Gemfile(38B)
----spec()
--------lib()
--------spec_helper.rb(745B)
----Rakefile(352B)
----README.markdown(1KB)
----LICENSE(1KB)
----mega_mutex.gemspec(1KB)
----.gitignore(69B)

网友评论