Module: Sequel::Plugins::ConcurrentThreadPoolEagerLoading
- Defined in:
- lib/sequel/plugins/concurrent_thread_pool_eager_loading.rb
Overview
Concurrent eager loading using concurrent_thread_pool extension. Adapted from Sequel’s built-in concurrent_eager_loading plugin but uses our concurrent_thread_pool extension instead of async_thread_pool.
Usage:
DB.extension(:concurrent_thread_pool)
Album.plugin :concurrent_thread_pool_eager_loading
Album.eager_load_concurrently.eager(:artist, :genre, :tracks).all
# Always concurrent by default:
Album.plugin :concurrent_thread_pool_eager_loading, always: true
Defined Under Namespace
Modules: ClassMethods, DatasetMethods
Class Method Summary collapse
Class Method Details
.configure(mod, opts = OPTS) ⇒ Object
18 19 20 21 22 |
# File 'lib/sequel/plugins/concurrent_thread_pool_eager_loading.rb', line 18 def self.configure(mod, opts = OPTS) if opts.key?(:always) mod.instance_variable_set(:@always_eager_load_concurrently, opts[:always]) end end |