Module: Frivol::Config
- Defined in:
- lib/frivol.rb
Overview
Frivol::Config
Sets the Frivol configuration (currently only the Redis config), allows access to the configured Redis instance, and has a helper method to include Frivol in a class with an optional storage expiry parameter
Class Method Summary collapse
-
.include_in(host_class, storage_expires_in = nil) ⇒ Object
A convenience method to include Frivol in a class, with an optional storage expiry parameter.
-
.redis ⇒ Object
Returns the configured Redis instance.
-
.redis_config=(config) ⇒ Object
Set the Redis configuration.
Class Method Details
.include_in(host_class, storage_expires_in = nil) ⇒ Object
A convenience method to include Frivol in a class, with an optional storage expiry parameter.
For example, you might have the following in environment.rb:
Frivol::Config.redis_config = REDIS_CONFIG
Frivol::Config.include_in ActiveRecord::Base, 600
Which would include Frivol in ActiveRecord::Base and set the default storage expiry to 10 minutes
180 181 182 183 |
# File 'lib/frivol.rb', line 180 def self.include_in(host_class, storage_expires_in = nil) host_class.send(:include, Frivol) host_class.storage_expires_in storage_expires_in if storage_expires_in end |
.redis ⇒ Object
Returns the configured Redis instance
170 171 172 |
# File 'lib/frivol.rb', line 170 def self.redis @@redis end |