Module: IdentityCache::CacheKeyGeneration::ClassMethods
- Defined in:
- lib/identity_cache/cache_key_generation.rb
Instance Method Summary collapse
- #prefixed_rails_cache_key ⇒ Object
- #rails_cache_key(id) ⇒ Object
- #rails_cache_key_for_attribute_and_fields_and_values(attribute, fields, values, unique) ⇒ Object
- #rails_cache_key_namespace ⇒ Object
- #rails_cache_key_prefix ⇒ Object
Instance Method Details
#prefixed_rails_cache_key ⇒ Object
34 35 36 |
# File 'lib/identity_cache/cache_key_generation.rb', line 34 def prefixed_rails_cache_key "#{rails_cache_key_namespace}blob:#{base_class.name}:#{rails_cache_key_prefix}:" end |
#rails_cache_key(id) ⇒ Object
26 27 28 |
# File 'lib/identity_cache/cache_key_generation.rb', line 26 def rails_cache_key(id) "#{prefixed_rails_cache_key}#{id}" end |
#rails_cache_key_for_attribute_and_fields_and_values(attribute, fields, values, unique) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/identity_cache/cache_key_generation.rb', line 38 def rails_cache_key_for_attribute_and_fields_and_values(attribute, fields, values, unique) unique_indicator = unique ? '' : 's' "#{rails_cache_key_namespace}" \ "attr#{unique_indicator}" \ ":#{base_class.name}" \ ":#{attribute}" \ ":#{rails_cache_string_for_fields_and_values(fields, values)}" end |
#rails_cache_key_namespace ⇒ Object
47 48 49 50 |
# File 'lib/identity_cache/cache_key_generation.rb', line 47 def rails_cache_key_namespace ns = IdentityCache.cache_namespace ns.is_a?(Proc) ? ns.call(self) : ns end |
#rails_cache_key_prefix ⇒ Object
30 31 32 |
# File 'lib/identity_cache/cache_key_generation.rb', line 30 def rails_cache_key_prefix @rails_cache_key_prefix ||= IdentityCache::CacheKeyGeneration.denormalized_schema_hash(self) end |