Sha256: a31ff9c5df18f6c4de5edb8de21e89f75980d7068b6ac2527e2fec4f91ffc9c3
Contents?: true
Size: 852 Bytes
Versions: 5
Compression:
Stored size: 852 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 results_from_backend = revision.obj_mget_request(missing_ids) results_from_backend.each do |result| if result cache.write_obj(result["_id"], result) end end results_from_cache.map do |result| result || results_from_backend.shift end end overall_results.map do |raw_data| Backend::ObjDataFromRest.new(raw_data) if raw_data end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems