Module: Sequel::Plugins::StaticCache::ForbidLazyLoadClassMethods

Defined in:
lib/sequel/plugins/static_cache.rb

Instance Method Summary collapse

Instance Method Details

#cache_get_pk(pk) ⇒ Object

Do not forbid lazy loading for single object retrieval.



254
255
256
# File 'lib/sequel/plugins/static_cache.rb', line 254

def cache_get_pk(pk)
  primary_key_lookup(pk)
end

#first(*args) ⇒ Object

Use static cache to return first arguments.



259
260
261
262
263
264
265
266
267
# File 'lib/sequel/plugins/static_cache.rb', line 259

def first(*args)
  if !defined?(yield) && args.empty?
    if o = @all.first
      _static_cache_frozen_copy(o)
    end
  else
    super
  end
end