Module: CaChing::WriteThrough

Extended by:
ActiveSupport::Concern
Defined in:
lib/ca_ching/write_through.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#destroy_with_cacheObject



22
23
24
25
26
27
# File 'lib/ca_ching/write_through.rb', line 22

def destroy_with_cache(*)
  return destroy_without_cache if CaChing.cache.nil? || CaChing.disabled?
  
  CaChing.cache.destroy(self)
  destroy_without_cache
end

#save_with_cacheObject



8
9
10
11
12
13
# File 'lib/ca_ching/write_through.rb', line 8

def save_with_cache(*)
  return save_without_cache if CaChing.cache.nil? || CaChing.disabled?
  
  CaChing.cache.update(self)
  save_without_cache
end

#save_with_cache!Object



15
16
17
18
19
20
# File 'lib/ca_ching/write_through.rb', line 15

def save_with_cache!
  return save_without_cache! if CaChing.cache.nil? || CaChing.disabled?
  
  CaChing.cache.update(self)
  save_without_cache!
end