Module: CacheStoreExtension
- Defined in:
- app/models/cache_store_extension.rb
Overview
This extends the class of Rails.cache. This file is required by the cache_store_extension initializer.
Instance Method Summary collapse
Instance Method Details
#delete_regex(regex) ⇒ Object
21 22 23 24 25 26 |
# File 'app/models/cache_store_extension.rb', line 21 def delete_regex(regex) if @data keys = @data.keys.select { |key| key =~ regex } @data.del(*keys) if keys.count > 0 end end |
#fetch(key, options = {}, &block) ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/models/cache_store_extension.rb', line 13 def fetch(key, = {}, &block) rescue_from_undefined_class_or_module do rescue_from_other_errors(block) do super(key, {force: @ignore_cache}.merge(), &block) end end end |
#uncached ⇒ Object
6 7 8 9 10 11 |
# File 'app/models/cache_store_extension.rb', line 6 def uncached @ignore_cache = true result = yield @ignore_cache = false return result end |