module AkidoLib::ReferenceInstanceExtensions

Public Instance Methods

read() click to toggle source
Calls superclass method
# File lib/caching.rb, line 3
def read
  model, id = reference.match(/(\D+)\/(\d+)/).captures
  cached_models = Redis::HashKey.new(model)
  if matching_cached_model = cached_models[id]
    return "FHIR::#{model}".constantize.new(JSON.parse(matching_cached_model))
  else
    model = super
    cached_models[model.id] = model.to_json
    return model
  end
end