Exception: RailsNamedCache::UnknownStoreError

Inherits:
Error
  • Object
show all
Defined in:
lib/rails_named_cache.rb

Overview

Raised when a named cache store is looked up but was never registered.

Rails.cache(:nope)
# => RailsNamedCache::UnknownStoreError:
#      Unknown named cache store :nope
#
#      Available stores:
#      :memory

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, available) ⇒ UnknownStoreError



45
46
47
48
49
50
51
# File 'lib/rails_named_cache.rb', line 45

def initialize(name, available)
  @name = name
  # Sorted so the message is deterministic regardless of registration order.
  @available = available.sort
  listed = @available.empty? ? "(none registered)" : @available.map(&:inspect).join("\n")
  super("Unknown named cache store #{name.inspect}\n\nAvailable stores:\n#{listed}")
end

Instance Attribute Details

#availableArray<Symbol> (readonly)



41
42
43
# File 'lib/rails_named_cache.rb', line 41

def available
  @available
end

#nameSymbol (readonly)



38
39
40
# File 'lib/rails_named_cache.rb', line 38

def name
  @name
end