Module: FasterCacheKeys

Included in:
Issue, Note
Defined in:

Instance Method Summary collapse

Instance Method Details


A faster version of Rails' “cache_key” method.

Rails' default “cache_key” method uses all kind of complex logic to figure out the cache key. In many cases this complexity and overhead may not be needed.

This method does not do any timestamp parsing as this process is quite expensive and not needed when generating cache keys. This method also relies on the table name instead of the cache namespace name as the latter uses complex logic to generate the exact same value (as when using the table name) in 99% of the cases.

# File 'app/models/concerns/faster_cache_keys.rb', line 15

def cache_key