mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
ddcc67115c
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@315 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
32 lines
No EOL
723 B
Ruby
32 lines
No EOL
723 B
Ruby
#!/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 |