class PIM::Services::DataModelLoaders::DataModelCacheLoader

A “caching” only loader for data model objects.

Public Class Methods

new() click to toggle source
# File services.rb, line 1521
def initialize
  @caches = {}
end

Public Instance Methods

get(data_module, request) click to toggle source
# File services.rb, line 1525
def get data_module, request

  # Get objects from data model cache
  cache = get_repository(data_module)
  return nil if cache.nil?

  # Since a caching loader is supposed to query the next loaders,
  # we should not return nil for non found keys!
  return get_from_repository(cache, request, cached: true, return_nil: false)
end
put(data_module, request, result) click to toggle source
# File services.rb, line 1536
def put data_module, request, result

  # Put objects into data model cache
  cache = get_repository(data_module, create: true)

  return put_into_repository(cache, request, result)
end