Class: Erector::Cache
- Inherits:
-
Object
- Object
- Erector::Cache
- Includes:
- Singleton
- Defined in:
- lib/erector/cache.rb
Instance Method Summary collapse
Instance Method Details
#[](*args) ⇒ Object
12 13 14 |
# File 'lib/erector/cache.rb', line 12 def [](*args) ::Rails.cache.read(transform_key(args)) end |
#[]=(*args) ⇒ Object
7 8 9 10 |
# File 'lib/erector/cache.rb', line 7 def []=(*args) value = args.pop ::Rails.cache.write(transform_key(args), value.to_s) end |
#delete(*args) ⇒ Object
16 17 18 |
# File 'lib/erector/cache.rb', line 16 def delete(*args) ::Rails.cache.delete(transform_key(args)) end |
#transform_key(args) ⇒ Object
20 21 22 |
# File 'lib/erector/cache.rb', line 20 def transform_key(args) ActiveSupport::Cache.(args.reject { |x| x.nil? }, 'erector') end |