Method: Arena::Cache::Adaptor::Rails.method_missing
- Defined in:
- lib/arena/cache/adaptor/rails.rb
.method_missing(method, *args) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/arena/cache/adaptor/rails.rb', line 9 def self.method_missing(method, *args) # Brittle/ugly but works for the time being # key = args.present? ? "arena_#{method}_#{args.first}" : "arena_#{method}" cache = Rails.cache.read(key) if cache.nil? object = args.present? ? Arena.send(method, args.first) : Arena.send(method) Rails.cache.write(key, object, expires_in: Arena.expires_in) cache = Rails.cache.read(key) end cache end |