class ArCache::Configuration
Attributes
cache_lock[W]
cache_store[R]
disabled[RW]
expires_in[RW]
lock_statement[W]
select_disabled[RW]
tables_options[R]
Public Class Methods
cache_lock?()
click to toggle source
# File lib/ar_cache/configuration.rb, line 14 def cache_lock? @cache_lock end
cache_store=(cache_store)
click to toggle source
# File lib/ar_cache/configuration.rb, line 26 def cache_store=(cache_store) if !cache_store.is_a?(ActiveSupport::Cache::Store) # rubocop:disable Style/GuardClause raise ArgumentError, 'The cache_store must be an ActiveSupport::Cache::Store object' elsif cache_store.class.name == 'ActiveSupport::Cache::RedisCacheStore' # rubocop:disable Style/ClassEqualityComparison @redis = true elsif cache_store.class.name == 'ActiveSupport::Cache::MemCacheStore' # rubocop:disable Style/ClassEqualityComparison @memcached = true end @cache_store = cache_store end
configure() { |self| ... }
click to toggle source
# File lib/ar_cache/configuration.rb, line 10 def configure block_given? ? yield(self) : self end
get_table_options(name)
click to toggle source
# File lib/ar_cache/configuration.rb, line 42 def get_table_options(name) options = tables_options[name.to_sym] || {} options[:disabled] = disabled unless options.key?(:disabled) options[:select_disabled] = select_disabled unless options.key?(:select_disabled) options[:unique_indexes] = Array(options[:unique_indexes]).map { |index| Array(index).map(&:to_s).uniq }.uniq options end
lock_statement()
click to toggle source
# 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
memcached?()
click to toggle source
# File lib/ar_cache/configuration.rb, line 22 def memcached? @memcached end
redis?()
click to toggle source
# File lib/ar_cache/configuration.rb, line 18 def redis? @redis end
tables_options=(options)
click to toggle source
# File lib/ar_cache/configuration.rb, line 38 def tables_options=(options) @tables_options = options.deep_symbolize_keys end