Class: ArCache::Configuration
- Inherits:
-
Object
- Object
- ArCache::Configuration
- Defined in:
- lib/ar_cache/configuration.rb
Class Attribute Summary collapse
-
.cache_lock ⇒ Object
writeonly
Sets the attribute cache_lock.
-
.cache_store ⇒ Object
Returns the value of attribute cache_store.
-
.disabled ⇒ Object
Returns the value of attribute disabled.
-
.expires_in ⇒ Object
Returns the value of attribute expires_in.
- .lock_statement ⇒ Object
-
.select_disabled ⇒ Object
Returns the value of attribute select_disabled.
-
.tables_options ⇒ Object
Returns the value of attribute tables_options.
Class Method Summary collapse
- .cache_lock? ⇒ Boolean
- .configure ⇒ Object
- .get_table_options(name) ⇒ Object
- .memcached? ⇒ Boolean
- .redis? ⇒ Boolean
Class Attribute Details
.cache_lock=(value) ⇒ Object (writeonly)
Sets the attribute cache_lock
6 7 8 |
# File 'lib/ar_cache/configuration.rb', line 6 def cache_lock=(value) @cache_lock = value end |
.cache_store ⇒ Object
Returns the value of attribute cache_store.
7 8 9 |
# File 'lib/ar_cache/configuration.rb', line 7 def cache_store @cache_store end |
.disabled ⇒ Object
Returns the value of attribute disabled.
8 9 10 |
# File 'lib/ar_cache/configuration.rb', line 8 def disabled @disabled end |
.expires_in ⇒ Object
Returns the value of attribute expires_in.
8 9 10 |
# File 'lib/ar_cache/configuration.rb', line 8 def expires_in @expires_in end |
.lock_statement ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/ar_cache/configuration.rb', line 50 def lock_statement @lock_statement ||= case ::ActiveRecord::Base.connection.class.name when 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter' 'FOR SHARE' when 'ActiveRecord::ConnectionAdapters::Mysql2Adapter' 'LOCK IN SHARE MODE' when 'ActiveRecord::ConnectionAdapters::SQLite3Adapter' raise "SQLite3 don't support lock statement, please use cache lock." else raise "Arcache can't identify database, please defined lock statement or use cache lock" end end |
.select_disabled ⇒ Object
Returns the value of attribute select_disabled.
8 9 10 |
# File 'lib/ar_cache/configuration.rb', line 8 def select_disabled @select_disabled end |
.tables_options ⇒ Object
Returns the value of attribute tables_options.
7 8 9 |
# File 'lib/ar_cache/configuration.rb', line 7 def @tables_options end |
Class Method Details
.cache_lock? ⇒ Boolean
14 15 16 |
# File 'lib/ar_cache/configuration.rb', line 14 def cache_lock? @cache_lock end |
.configure ⇒ Object
10 11 12 |
# File 'lib/ar_cache/configuration.rb', line 10 def configure block_given? ? yield(self) : self end |
.get_table_options(name) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/ar_cache/configuration.rb', line 42 def (name) = [name.to_sym] || {} [:disabled] = disabled unless .key?(:disabled) [:select_disabled] = select_disabled unless .key?(:select_disabled) [:unique_indexes] = Array([:unique_indexes]).map { |index| Array(index).map(&:to_s).uniq }.uniq end |
.memcached? ⇒ Boolean
22 23 24 |
# File 'lib/ar_cache/configuration.rb', line 22 def memcached? @memcached end |
.redis? ⇒ Boolean
18 19 20 |
# File 'lib/ar_cache/configuration.rb', line 18 def redis? @redis end |