Sha256: c0ed8516de97f45bc554e34d438643b343bad14cbf9288e0d20ea92209711978
Contents?: true
Size: 573 Bytes
Versions: 36
Compression:
Stored size: 573 Bytes
Contents
require 'active_resource' module Ddr # # Abstract superclass for resources bound to ddr-aux API data # class AuxiliaryResource < ActiveResource::Base # ActiveResource freezes `site` in subclasses self.site = Ddr.ddr_aux_api_url class_attribute :cache_expiry, instance_accessor: false self.cache_expiry = 1.hour def self.fetch(value_key, &block) Rails.cache.fetch(cache_key(value_key), expires_in: cache_expiry, &block) end def self.cache_key(suffix) [ model_name.cache_key, suffix ].join('/') end end end
Version data entries
36 entries across 36 versions & 1 rubygems