Sha256: 50051852c06212ec718b296b94bbf4824196ebfcdd75df756f0e07052e3ea985

Contents?: true

Size: 1005 Bytes

Versions: 80

Compression:

Stored size: 1005 Bytes

Contents

module Scrivito
module Backend

module ObjLoad
class << self

  def load(revision, ids)
    cache = Backend::ObjDataCache.view_for_revision(revision)

    missing_ids = []
    results_from_cache = ids.map do |id|
      result = cache.read_obj(id)

      missing_ids << id unless result

      result
    end

    overall_results =
      if missing_ids.blank?
        results_from_cache
      else
        raw_results = revision.obj_mget_request(missing_ids)

        results_from_backend = raw_results.map do |result|
          ObjDataCache.convert_from_backend(result)
        end

        results_from_backend.each_with_index do |result, index|
          cache.write_obj(missing_ids[index], result)
        end

        results_from_cache.map do |result|
          result || results_from_backend.shift
        end
      end

    overall_results.map do |raw_data|
      if raw_data != ObjDataCache::NONEXISTENT_OBJ
        Backend::ObjDataFromRest.new(raw_data)
      end
    end
  end

end
end

end
end

Version data entries

80 entries across 80 versions & 1 rubygems

Version Path
scrivito_sdk-1.9.1 lib/scrivito/backend/obj_load.rb
scrivito_sdk-1.9.1.rc1 lib/scrivito/backend/obj_load.rb
scrivito_sdk-1.9.0 lib/scrivito/backend/obj_load.rb
scrivito_sdk-1.9.0.rc2 lib/scrivito/backend/obj_load.rb
scrivito_sdk-1.9.0.rc1 lib/scrivito/backend/obj_load.rb
scrivito_sdk-1.8.1 lib/scrivito/backend/obj_load.rb
scrivito_sdk-1.8.1.rc1 lib/scrivito/backend/obj_load.rb
scrivito_sdk-1.8.0 lib/scrivito/backend/obj_load.rb
scrivito_sdk-1.8.0.rc2 lib/scrivito/backend/obj_load.rb
scrivito_sdk-1.8.0.rc1 lib/scrivito/backend/obj_load.rb
scrivito_sdk-1.7.0 lib/scrivito/backend/obj_load.rb
scrivito_sdk-1.7.0.rc2 lib/scrivito/backend/obj_load.rb
scrivito_sdk-1.5.5 lib/scrivito/backend/obj_load.rb
scrivito_sdk-1.6.1 lib/scrivito/backend/obj_load.rb
scrivito_sdk-1.6.1.rc1 lib/scrivito/backend/obj_load.rb
scrivito_sdk-1.5.5.rc1 lib/scrivito/backend/obj_load.rb
scrivito_sdk-1.4.3 lib/scrivito/backend/obj_load.rb
scrivito_sdk-1.5.4 lib/scrivito/backend/obj_load.rb
scrivito_sdk-1.7.0.rc1 lib/scrivito/backend/obj_load.rb
scrivito_sdk-1.6.0 lib/scrivito/backend/obj_load.rb