class AWS::Core::ResourceCache
@api private
Public Class Methods
new()
click to toggle source
# File lib/aws/core/resource_cache.rb, line 20 def initialize @cache = {} end
Public Instance Methods
cached?(key, attribute)
click to toggle source
# File lib/aws/core/resource_cache.rb, line 28 def cached?(key, attribute) attributes = @cache[key] and attributes.has_key?(attribute) end
get(key, attribute)
click to toggle source
# File lib/aws/core/resource_cache.rb, line 32 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/aws/core/resource_cache.rb, line 24 def store(key, attributes) (@cache[key] ||= {}).merge!(attributes) end