Class: Cache::Object::KeyGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/cache/object/key_generator.rb

Class Method Summary collapse

Class Method Details

.key_for_mapping(class_name, attributes) ⇒ Object



8
9
10
11
12
13
# File 'lib/cache/object/key_generator.rb', line 8

def self.key_for_mapping(class_name, attributes)
  attributes_key = attributes.map do |k, v|
    "#{k}-#{v}"
  end.join('-')
  "#{class_name}-#{attributes_key}"
end

.key_for_object(class_name, id) ⇒ Object



4
5
6
# File 'lib/cache/object/key_generator.rb', line 4

def self.key_for_object(class_name, id)
  "#{class_name}-#{id}"
end