class Orchestrate::Application::SimpleCacheStore

When enabled, the cache mechanism:

Public Class Methods

disable() click to toggle source
# File rails/lib/orchestrate_application/simple_cache_store.rb, line 156
def self.disable
  puts "SC-DISABLE"
  @@is_enabled = false
end
enable() click to toggle source
# File rails/lib/orchestrate_application/simple_cache_store.rb, line 150
def self.enable
  puts "SC-ENABLE"
  @@is_enabled = true
  # puts "SIMPLE-CACHE has been DISABLED for the current version."
end
instance() click to toggle source
# File rails/lib/orchestrate_application/simple_cache_store.rb, line 145
def self.instance
  @@cache ||= @@instance.simple_cache_init
  @@instance
end

Private Class Methods

new() click to toggle source
# File rails/lib/orchestrate_application/simple_cache_store.rb, line 130
def initialize
  @@is_enabled ||= false
  @@cache ||= simple_cache_init
  # puts "SC-init: cache -> '#{@@cache}', '#{!@@cache.nil?}'"
  @@refs ||= {}
end

Public Instance Methods

cache() click to toggle source
# File rails/lib/orchestrate_application/simple_cache_store.rb, line 167
def cache
  @@cache
end
disable() click to toggle source
# File rails/lib/orchestrate_application/simple_cache_store.rb, line 210
def disable
  self.class.disable
end
enable() click to toggle source
# File rails/lib/orchestrate_application/simple_cache_store.rb, line 206
def enable
  self.class.enable
end
fetch(collection, key) click to toggle source
# File rails/lib/orchestrate_application/simple_cache_store.rb, line 198
def fetch(collection, key)
  get_cc(collection).fetch(key)
end
flush!(collection=nil) click to toggle source
# File rails/lib/orchestrate_application/simple_cache_store.rb, line 171
def flush!(collection=nil)
  if collection
    get_cc(collection).flush!
  else
    @@cache = simple_cache_init
  end
end
get_cache_collection(name) click to toggle source
# File rails/lib/orchestrate_application/simple_cache_store.rb, line 179
def get_cache_collection(name)
  cache[name]
end
get_cc(name) click to toggle source
# File rails/lib/orchestrate_application/simple_cache_store.rb, line 183
def get_cc(name)
  get_cache_collection name
end
get_ref(collection_name, key) click to toggle source
# File rails/lib/orchestrate_application/simple_cache_store.rb, line 194
def get_ref(collection_name, key)
  get_cc(collection_name).get_ref key
end
is_enabled?() click to toggle source
# File rails/lib/orchestrate_application/simple_cache_store.rb, line 202
def is_enabled?
  @@is_enabled
end
save(document) click to toggle source
# File rails/lib/orchestrate_application/simple_cache_store.rb, line 187
def save(document)
  m = document.metadata
  get_cc(m.from_collection).save_graph(m) if m.respond_to? :kind and m.kind
  get_cc(m.collection).save m
  SimpleCacheRefs.instance.save m.ref, document
end
simple_cache_init() click to toggle source
# File rails/lib/orchestrate_application/simple_cache_store.rb, line 137
def simple_cache_init
  cache = Hash[Schema.instance.collection_names.map { |name|
    [name, SimpleCacheCollection.new(name)]
  }]
  # puts "SC-sc_init -> '#{cache}', is_enabled -> '#{@@is_enabled}'"
  cache == {} ? nil : cache
end