class Fluent::PluginHelper::Storage::SynchronizeWrapper

Public Class Methods

new(storage) click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 275
def initialize(storage)
  @storage = storage
  @mutex = Mutex.new
end

Public Instance Methods

delete(key) click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 317
def delete(key)
  @mutex.synchronize{ @storage.delete(key) }
end
fetch(key, defval) click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 309
def fetch(key, defval)
  @mutex.synchronize{ @storage.fetch(key, defval) }
end
get(key) click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 305
def get(key)
  @mutex.synchronize{ @storage.get(key) }
end
implementation() click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 289
def implementation
  @storage
end
load() click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 293
def load
  @mutex.synchronize do
    @storage.load
  end
end
put(key, value) click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 313
def put(key, value)
  @mutex.synchronize{ @storage.put(key, value) }
end
save() click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 299
def save
  @mutex.synchronize do
    @storage.save
  end
end
synchronized?() click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 285
def synchronized?
  true
end
update(key, &block) click to toggle source
# File lib/fluent/plugin_helper/storage.rb, line 321
def update(key, &block)
  @mutex.synchronize do
    v = block.call(@storage.get(key))
    @storage.put(key, v)
    v
  end
end