2013-03-06 02:52:24 -05:00
|
|
|
# Like a hash, just does its best to stay in sync across the farm
|
2013-02-05 14:16:51 -05:00
|
|
|
#
|
|
|
|
# Redis backed with an allowance for a certain amount of latency
|
|
|
|
|
|
|
|
|
|
|
|
class DistributedHash
|
|
|
|
|
|
|
|
@lock = Mutex.new
|
|
|
|
|
|
|
|
def self.ensure_subscribed
|
2013-02-25 11:42:20 -05:00
|
|
|
@lock.synchronize do
|
|
|
|
unless @subscribed
|
2013-02-05 14:16:51 -05:00
|
|
|
|
|
|
|
end
|
|
|
|
@subscribed = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def initialize(key, options={})
|
|
|
|
@key = key
|
|
|
|
end
|
|
|
|
|
|
|
|
def []=(k,v)
|
|
|
|
end
|
|
|
|
|
|
|
|
def [](k)
|
|
|
|
end
|
|
|
|
|
|
|
|
def delete(k)
|
|
|
|
end
|
|
|
|
|
|
|
|
def clear
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|