Sha256: c0fea0ab24144dcb0c5c73f859b1091218a400685e2a47dce935d1b477fa246b
Contents?: true
Size: 709 Bytes
Versions: 1
Compression:
Stored size: 709 Bytes
Contents
class AttributeCustomization module LocalCache class NamespaceCache < Struct.new(:namespace) include Traveller::LocalCache def fetch_value AttributeCustomization.where(namespace: namespace).index_by(&:name) end def cache_name "attribute_customizations_#{namespace}" end end extend ActiveSupport::Concern included do after_save { self.class.namespace_cache_for(namespace).expire! } after_destroy { self.class.namespace_cache_for(namespace).expire! } end module ClassMethods def namespace_cache_for(namespace) (@namespace_cache ||= {})[namespace] ||= NamespaceCache.new(namespace) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axle_attributes-1.13.2 | app/models/attribute_customization/local_cache.rb |