Class: SolidCache::Record

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/solid_cache/record.rb

Direct Known Subclasses

Entry

Constant Summary collapse

NULL_INSTRUMENTER =
ActiveSupport::Notifications::Instrumenter.new(ActiveSupport::Notifications::Fanout.new)

Class Method Summary collapse

Class Method Details

.disable_instrumentationObject



10
11
12
13
14
# File 'app/models/solid_cache/record.rb', line 10

def disable_instrumentation
  connection.with_instrumenter(NULL_INSTRUMENTER) do
    yield
  end
end

.with_shard(shard, &block) ⇒ Object



16
17
18
19
20
21
22
# File 'app/models/solid_cache/record.rb', line 16

def with_shard(shard, &block)
  if shard && shard != Record.current_shard
    Record.connected_to(shard: shard, &block)
  else
    block.call
  end
end