Module: SimpleStack::Cacheable

Included in:
Collection, Entity, Hypervisor
Defined in:
lib/simple_stack/cacheable.rb

Instance Method Summary collapse

Instance Method Details

#cacheable?Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
14
# File 'lib/simple_stack/cacheable.rb', line 8

def cacheable?
  if respond_to? :connection
    connection.cache_enabled
  else
    false
  end
end

#cached_attributesObject



16
17
18
19
20
21
22
# File 'lib/simple_stack/cacheable.rb', line 16

def cached_attributes
  if cacheable?
    @cached_attributes ||= {}
  else
    {}
  end
end

#reloadObject



3
4
5
6
# File 'lib/simple_stack/cacheable.rb', line 3

def reload
  @cached_attributes = {}
  self
end