class MSS::Core::ResourceCache

@api private

Public Class Methods

new() click to toggle source
# File lib/mss/core/resource_cache.rb, line 19
def initialize
  @cache = {}
end

Public Instance Methods

cached?(key, attribute) click to toggle source
# File lib/mss/core/resource_cache.rb, line 27
def cached?(key, attribute)
  attributes = @cache[key] and attributes.has_key?(attribute)
end
get(key, attribute) click to toggle source
# File lib/mss/core/resource_cache.rb, line 31
def get(key, attribute)
  raise "No cached value for attribute :#{attribute} of #{key}" unless
    cached?(key, attribute)
  @cache[key][attribute]
end
store(key, attributes) click to toggle source
# File lib/mss/core/resource_cache.rb, line 23
def store(key, attributes)
  (@cache[key] ||= {}).merge!(attributes)
end