Class: SolidCache::Connections::Single
- Inherits:
-
Object
- Object
- SolidCache::Connections::Single
- Defined in:
- lib/solid_cache/connections/single.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #assign(keys) ⇒ Object
- #count ⇒ Object
-
#initialize(name) ⇒ Single
constructor
A new instance of Single.
- #names ⇒ Object
- #with(name, &block) ⇒ Object
- #with_connection_for(key, &block) ⇒ Object
- #with_each(&block) ⇒ Object
Constructor Details
#initialize(name) ⇒ Single
Returns a new instance of Single.
8 9 10 |
# File 'lib/solid_cache/connections/single.rb', line 8 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/solid_cache/connections/single.rb', line 6 def name @name end |
Instance Method Details
#assign(keys) ⇒ Object
26 27 28 |
# File 'lib/solid_cache/connections/single.rb', line 26 def assign(keys) { name => keys } end |
#count ⇒ Object
30 31 32 |
# File 'lib/solid_cache/connections/single.rb', line 30 def count 1 end |
#names ⇒ Object
34 35 36 |
# File 'lib/solid_cache/connections/single.rb', line 34 def names [ name ] end |
#with(name, &block) ⇒ Object
18 19 20 |
# File 'lib/solid_cache/connections/single.rb', line 18 def with(name, &block) Record.with_shard(name, &block) end |
#with_connection_for(key, &block) ⇒ Object
22 23 24 |
# File 'lib/solid_cache/connections/single.rb', line 22 def with_connection_for(key, &block) with(name, &block) end |
#with_each(&block) ⇒ Object
12 13 14 15 16 |
# File 'lib/solid_cache/connections/single.rb', line 12 def with_each(&block) return enum_for(:with_each) unless block_given? with(name, &block) end |