Class: ThreeScale::Backend::StorageSync

Inherits:
Object
  • Object
show all
Includes:
Configurable
Defined in:
lib/3scale/backend/storage_sync.rb

Class Method Summary collapse

Methods included from Configurable

#configuration, #configuration=, included

Class Method Details

.instance(reset = false) ⇒ Object

Returns a shared instance of the storage. If there is no instance yet, creates one first. If you want to always create a fresh instance, set the reset parameter to true.



13
14
15
16
17
18
19
20
# File 'lib/3scale/backend/storage_sync.rb', line 13

def instance(reset = false)
  if reset || @instance.nil?
    @instance = new(Storage::Helpers.config_with(configuration.redis,
                    options: get_options))
  else
    @instance
  end
end

.new(options) ⇒ Object



22
23
24
# File 'lib/3scale/backend/storage_sync.rb', line 22

def new(options)
  Redis.new options
end