Method: Sequel::Plugins::StaticCache.configure
- Defined in:
- lib/sequel/plugins/static_cache.rb
.configure(model, opts = OPTS) ⇒ Object
Populate the static caches when loading the plugin. Options:
- :frozen
-
Whether retrieved model objects are frozen. The default is true, for better performance as the shared frozen objects can be used directly. If set to false, new instances are created.
64 65 66 67 68 69 70 71 72 |
# File 'lib/sequel/plugins/static_cache.rb', line 64 def self.configure(model, opts=OPTS) model.instance_exec do @static_cache_frozen = opts.fetch(:frozen, true) if @static_cache_frozen && defined?(::Sequel::Plugins::ForbidLazyLoad::ClassMethods) && is_a?(::Sequel::Plugins::ForbidLazyLoad::ClassMethods) extend ForbidLazyLoadClassMethods end load_cache end end |