Sha256: 9fed0a28eea6e1dfca3eabb85cf3d0a525e79f30d059298cfc5b45be3253116c
Contents?: true
Size: 724 Bytes
Versions: 8
Compression:
Stored size: 724 Bytes
Contents
#!/usr/local/bin/ruby -w # This is a really simple session storage daemon, basically just a hash, # which is enabled for DRb access. require 'drb' session_hash = Hash.new session_hash.instance_eval { @mutex = Mutex.new } class <<session_hash def []=(key, value) @mutex.synchronize do super(key, value) end end def [](key) @mutex.synchronize do super(key) end end def delete(key) @mutex.synchronize do super(key) end end end DRb.start_service('druby://127.0.0.1:9192', session_hash) DRb.thread.join
Version data entries
8 entries across 8 versions & 1 rubygems