changing table user acceptance specs in the green

This commit is contained in:
2014-06-25 16:11:29 +02:00
parent 0e4993e8a6
commit 58f0937570
9 changed files with 89 additions and 45 deletions
+20 -8
View File
@@ -3,27 +3,39 @@
# a clean start and Hash#clear is soooo much faster than
# a couchbase bucket flush
class InMemoryQCounter
STORE = {}
attr_reader :store
def initialize
@store = {}
end
def get(key, options = {})
STORE[key]
store[key]
end
def set(key, value)
STORE[key] = value
store[key] = value
end
def incr(key, options = {})
STORE[key] ||= options[:initial].to_i
STORE[key] += 1
store[key] ||= options[:initial].to_i
store[key] += 1
end
def decr(key, options = {})
STORE[key] ||= options[:initial].to_i
STORE[key] -= 1
store[key] ||= options[:initial].to_i
store[key] -= 1
end
def flush
STORE.clear
store.clear
end
end
=begin Make drb server
require 'drb'
DRb.start_service 'druby://:9000', InMemoryQCounter.new
puts "Counter server running at #{DRb.uri}"
trap("INT") { DRb.stop_service }
DRb.thread.join
=end