Class: SolidCache::Configuration
- Inherits:
-
Object
- Object
- SolidCache::Configuration
- Defined in:
- lib/solid_cache/configuration.rb
Instance Attribute Summary collapse
-
#connects_to ⇒ Object
readonly
Returns the value of attribute connects_to.
-
#encrypt ⇒ Object
readonly
Returns the value of attribute encrypt.
-
#encryption_context_properties ⇒ Object
readonly
Returns the value of attribute encryption_context_properties.
-
#executor ⇒ Object
readonly
Returns the value of attribute executor.
-
#size_estimate_samples ⇒ Object
readonly
Returns the value of attribute size_estimate_samples.
-
#store_options ⇒ Object
readonly
Returns the value of attribute store_options.
Instance Method Summary collapse
- #encrypt? ⇒ Boolean
-
#initialize(store_options: {}, database: nil, databases: nil, connects_to: nil, executor: nil, encrypt: false, encryption_context_properties: nil, size_estimate_samples: 10_000) ⇒ Configuration
constructor
A new instance of Configuration.
- #shard_keys ⇒ Object
- #sharded? ⇒ Boolean
Constructor Details
#initialize(store_options: {}, database: nil, databases: nil, connects_to: nil, executor: nil, encrypt: false, encryption_context_properties: nil, size_estimate_samples: 10_000) ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 12 13 14 15 |
# File 'lib/solid_cache/configuration.rb', line 7 def initialize(store_options: {}, database: nil, databases: nil, connects_to: nil, executor: nil, encrypt: false, encryption_context_properties: nil, size_estimate_samples: 10_000) @store_options = @size_estimate_samples = size_estimate_samples @executor = executor @encrypt = encrypt @encryption_context_properties = encryption_context_properties @encryption_context_properties ||= default_encryption_context_properties if encrypt? set_connects_to(database: database, databases: databases, connects_to: connects_to) end |
Instance Attribute Details
#connects_to ⇒ Object (readonly)
Returns the value of attribute connects_to.
5 6 7 |
# File 'lib/solid_cache/configuration.rb', line 5 def connects_to @connects_to end |
#encrypt ⇒ Object (readonly)
Returns the value of attribute encrypt.
5 6 7 |
# File 'lib/solid_cache/configuration.rb', line 5 def encrypt @encrypt end |
#encryption_context_properties ⇒ Object (readonly)
Returns the value of attribute encryption_context_properties.
5 6 7 |
# File 'lib/solid_cache/configuration.rb', line 5 def encryption_context_properties @encryption_context_properties end |
#executor ⇒ Object (readonly)
Returns the value of attribute executor.
5 6 7 |
# File 'lib/solid_cache/configuration.rb', line 5 def executor @executor end |
#size_estimate_samples ⇒ Object (readonly)
Returns the value of attribute size_estimate_samples.
5 6 7 |
# File 'lib/solid_cache/configuration.rb', line 5 def size_estimate_samples @size_estimate_samples end |
#store_options ⇒ Object (readonly)
Returns the value of attribute store_options.
5 6 7 |
# File 'lib/solid_cache/configuration.rb', line 5 def @store_options end |
Instance Method Details
#encrypt? ⇒ Boolean
25 26 27 |
# File 'lib/solid_cache/configuration.rb', line 25 def encrypt? encrypt.present? end |
#shard_keys ⇒ Object
21 22 23 |
# File 'lib/solid_cache/configuration.rb', line 21 def shard_keys sharded? ? connects_to[:shards].keys : [] end |
#sharded? ⇒ Boolean
17 18 19 |
# File 'lib/solid_cache/configuration.rb', line 17 def sharded? connects_to && connects_to[:shards] end |