Module: FlagpoleSitta::BracketRetrieval

Extended by:
ActiveSupport::Concern
Defined in:
lib/flagpole_sitta/bracket_retrieval.rb

Overview

Used for getting and caching settings or html fragments stored in the database.

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#br_update(alive) ⇒ Object

After update destroy old cache and write new one.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/flagpole_sitta/bracket_retrieval.rb', line 24

def br_update alive

  clazz = self.class

  key = clazz.get_br_key(self.send(self.class.key_field + "_was"))

  FlagpoleSitta::CommonFs.flagpole_cache_delete(key)

  if alive
    key = clazz.get_br_key(self.send(self.class.key_field))
    value = self.send(self.class.value_field)
    FlagpoleSitta::CommonFs.flagpole_cache_write(key, value)
  end
  
end

#br_update_destroyObject



19
20
21
# File 'lib/flagpole_sitta/bracket_retrieval.rb', line 19

def br_update_destroy
  self.br_update(false)
end

#br_update_saveObject



15
16
17
# File 'lib/flagpole_sitta/bracket_retrieval.rb', line 15

def br_update_save
  self.br_update(true)
end