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.



267
268
269
# File 'lib/sequel/plugins/static_cache.rb', line 267

def cache_get_pk(pk)
  primary_key_lookup(pk)
end

#first(*args) ⇒ Object

Use static cache to return first arguments.



272
273
274
275
276
277
278
279
280
# File 'lib/sequel/plugins/static_cache.rb', line 272

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