Sha256: 002043a4f6a8c53f6539495a19085c446ba7f94ae09535871e358ac1d428ad46
Contents?: true
Size: 509 Bytes
Versions: 2
Compression:
Stored size: 509 Bytes
Contents
require 'thread' class Malm class MessageDb def initialize @sempahore = Mutex.new @message_db = [] end def create(message) @sempahore.synchronize do message[:id] = @message_db.size @message_db << message @message_db.size end end def find_all @sempahore.synchronize do @message_db.dup end end def find(id) @sempahore.synchronize do @message_db[id].dup end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
malm-0.0.6 | lib/malm/message_db.rb |
malm-0.0.5 | lib/malm/message_db.rb |