Module: ActiveRecordProxyAdapters::Mixin::Configuration
- Included in:
- Context, LogSubscriber, ActiveRecordProxyAdapters::Middleware, ActiveRecordProxyAdapters::Middleware, PrimaryReplicaProxy
- Defined in:
- lib/active_record_proxy_adapters/mixin/configuration.rb
Overview
Provides helpers to access to reduce boilerplate while retrieving configuration properties.
Instance Method Summary collapse
-
#cache_key_for(sql_string) ⇒ String
Helper to retrieve the cache key prefix from the configuration stored in CacheConfiguration#key_prefix.
-
#cache_store ⇒ ActiveSupport::Cache::Store
Helper to retrieve the cache store from the configuration stored in CacheConfiguration#store.
-
#checkout_timeout(database_name) ⇒ ActiveSupport::Duration
Helper to retrieve the checkout timeout from the configuration stored in DatabaseConfiguration#checkout_timeout.
-
#context_store ⇒ Class
Helper to retrieve the context store class from the configuration stored in Configuration#context_store.
-
#log_subscriber_prefix(database_name) ⇒ Proc
Helper to retrieve the proxy delay from the configuration stored in DatabaseConfiguration#log_subscriber_prefix.
-
#logger ⇒ Logger
Helper to retrieve the logger from the configuration stored in Configuration#logger.
-
#proxy_delay(database_name) ⇒ ActiveSupport::Duration
Helper to retrieve the proxy delay from the configuration stored in DatabaseConfiguration#proxy_delay.
-
#regexp_timeout_strategy ⇒ Proc
Helper to retrieve the timeout strategy from the configuration stored in Configuration#regexp_timeout_strategy.
Instance Method Details
#cache_key_for(sql_string) ⇒ String
Helper to retrieve the cache key prefix from the configuration stored in CacheConfiguration#key_prefix. It uses the key builder to generate a cache key for the given SQL string, prepended with the key prefix.
67 68 69 |
# File 'lib/active_record_proxy_adapters/mixin/configuration.rb', line 67 def cache_key_for(sql_string) cache_config.key_builder.call(sql_string).prepend(cache_config.key_prefix) end |
#cache_store ⇒ ActiveSupport::Cache::Store
Helper to retrieve the cache store from the configuration stored in CacheConfiguration#store.
59 60 61 |
# File 'lib/active_record_proxy_adapters/mixin/configuration.rb', line 59 def cache_store cache_config.store end |
#checkout_timeout(database_name) ⇒ ActiveSupport::Duration
Helper to retrieve the checkout timeout from the configuration stored in DatabaseConfiguration#checkout_timeout.
31 32 33 |
# File 'lib/active_record_proxy_adapters/mixin/configuration.rb', line 31 def checkout_timeout(database_name) database_config(database_name).checkout_timeout end |
#context_store ⇒ Class
Helper to retrieve the context store class from the configuration stored in Configuration#context_store.
38 39 40 |
# File 'lib/active_record_proxy_adapters/mixin/configuration.rb', line 38 def context_store proxy_config.context_store end |
#log_subscriber_prefix(database_name) ⇒ Proc
Helper to retrieve the proxy delay from the configuration stored in DatabaseConfiguration#log_subscriber_prefix.
15 16 17 |
# File 'lib/active_record_proxy_adapters/mixin/configuration.rb', line 15 def log_subscriber_prefix(database_name) database_config(database_name).log_subscriber_prefix end |
#logger ⇒ Logger
Helper to retrieve the logger from the configuration stored in Configuration#logger.
45 46 47 |
# File 'lib/active_record_proxy_adapters/mixin/configuration.rb', line 45 def logger proxy_config.logger end |
#proxy_delay(database_name) ⇒ ActiveSupport::Duration
Helper to retrieve the proxy delay from the configuration stored in DatabaseConfiguration#proxy_delay.
23 24 25 |
# File 'lib/active_record_proxy_adapters/mixin/configuration.rb', line 23 def proxy_delay(database_name) database_config(database_name).proxy_delay end |
#regexp_timeout_strategy ⇒ Proc
Helper to retrieve the timeout strategy from the configuration stored in Configuration#regexp_timeout_strategy.
52 53 54 |
# File 'lib/active_record_proxy_adapters/mixin/configuration.rb', line 52 def regexp_timeout_strategy proxy_config.regexp_timeout_strategy end |