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

def fetch(key, options = {}, &block)

rescue_from_undefined_class_or_module do
  rescue_from_other_errors(block) do
    super(key, {force: @ignore_cache}.merge(options), &block)
  end
end

end



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

#uncachedObject



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