changing table user acceptance specs in the green
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user