Class: ObjectLogging::Log::RailsCache
- Defined in:
- lib/object_logging/log/rails_cache.rb
Instance Method Summary collapse
- #clear ⇒ Object
- #entries ⇒ Object
-
#initialize(object, options) ⇒ RailsCache
constructor
A new instance of RailsCache.
- #log(level, context, message) ⇒ Object
Constructor Details
#initialize(object, options) ⇒ RailsCache
Returns a new instance of RailsCache.
9 10 11 |
# File 'lib/object_logging/log/rails_cache.rb', line 9 def initialize(object, ) @key = make_key(object, ) end |
Instance Method Details
#clear ⇒ Object
21 22 23 |
# File 'lib/object_logging/log/rails_cache.rb', line 21 def clear Rails.cache.delete(key) end |
#entries ⇒ Object
17 18 19 |
# File 'lib/object_logging/log/rails_cache.rb', line 17 def entries Rails.cache.read(key) || [] end |
#log(level, context, message) ⇒ Object
13 14 15 |
# File 'lib/object_logging/log/rails_cache.rb', line 13 def log(level, context, ) Rails.cache.write(key, entries << [level, context, ]) end |