module InfoparkComponentCache::KeyGenerator

Public Class Methods

generate_key(anything) click to toggle source

@author Tomasz Przedmojski <tomasz.przedmojski@infopark.de>

Generates a key identifing an Object

@param [#cache_key, to_param] anything an Object that responds to cache_key.

It is assumed that calls to #cache_key produce consistent and deterministic
results. Futhermore for no two distinct objects should their #cache_key be equal

@return [String] string that does not contain file-system insecure characters (, / etc.)

# File lib/infopark_component_cache/key_generator.rb, line 13
def self.generate_key(anything)
  encode_key(Rails.cache.send(:expanded_key, anything))
end