Method: Orthor.caching

Defined in:
lib/orthor.rb

.caching(file, expiry = nil, options = {}) ⇒ Object



55
56
57
58
59
60
61
62
# File 'lib/orthor.rb', line 55

def self.caching(file, expiry = nil, options = {})
  expiry, options = nil, expiry if expiry.is_a?(Hash)

  klass = file.to_s.split('_').collect { |e| e.capitalize }.join
  Moneta.autoload(klass.to_sym, "moneta/#{file}")
  self.cache = Moneta.const_get(klass).new(options)
  self.cache_expiry = expiry
end