Class: CacheStache::Keyspace
- Inherits:
-
Object
- Object
- CacheStache::Keyspace
- Defined in:
- lib/cache_stache/keyspace.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
Returns the value of attribute label.
-
#name ⇒ Object
Returns the value of attribute name.
-
#pattern ⇒ Object
Returns the value of attribute pattern.
Instance Method Summary collapse
-
#initialize(name) ⇒ Keyspace
constructor
A new instance of Keyspace.
- #match?(key) ⇒ Boolean
- #validate! ⇒ Object
Constructor Details
#initialize(name) ⇒ Keyspace
Returns a new instance of Keyspace.
9 10 11 12 13 |
# File 'lib/cache_stache/keyspace.rb', line 9 def initialize(name) @name = name @label = name.to_s.humanize @pattern = nil end |
Instance Attribute Details
#label ⇒ Object
Returns the value of attribute label.
7 8 9 |
# File 'lib/cache_stache/keyspace.rb', line 7 def label @label end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/cache_stache/keyspace.rb', line 7 def name @name end |
#pattern ⇒ Object
Returns the value of attribute pattern.
7 8 9 |
# File 'lib/cache_stache/keyspace.rb', line 7 def pattern @pattern end |
Instance Method Details
#match?(key) ⇒ Boolean
15 16 17 18 19 20 21 |
# File 'lib/cache_stache/keyspace.rb', line 15 def match?(key) return false unless pattern pattern.match?(key.to_s) rescue => e Rails.logger.error("CacheStache: Keyspace #{name} matcher error: #{e.}") false end |