class Fluent::PluginHelper::Storage::SynchronizeWrapper

Public Class Methods

new(storage) click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 289
def initialize(storage)
  @storage = storage
  @monitor = Monitor.new
end

Public Instance Methods

delete(key) click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 335
def delete(key)
  @monitor.synchronize{ @storage.delete(key) }
end
fetch(key, defval) click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 327
def fetch(key, defval)
  @monitor.synchronize{ @storage.fetch(key, defval) }
end
get(key) click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 323
def get(key)
  @monitor.synchronize{ @storage.get(key) }
end
implementation() click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 307
def implementation
  @storage
end
load() click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 311
def load
  @monitor.synchronize do
    @storage.load
  end
end
method_missing(name, *args) click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 299
def method_missing(name, *args)
  @monitor.synchronize{ @storage.__send__(name, *args) }
end
put(key, value) click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 331
def put(key, value)
  @monitor.synchronize{ @storage.put(key, value) }
end
save() click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 317
def save
  @monitor.synchronize do
    @storage.save
  end
end
synchronized?() click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 303
def synchronized?
  true
end
update(key, &block) click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 339
def update(key, &block)
  @monitor.synchronize do
    v = block.call(@storage.get(key))
    @storage.put(key, v)
    v
  end
end