flyerhzm/simple_cacheable — pull request #52 by bkudria (2014-02-27 22:36:43+00:00)
Title: add a single method to override to customize cache keys

This commit adds a ```modified_cache_key``` method (on the instance and on the class level) that by default returns it's single argument unmodified. By passing all generated cache keys through this method, we expose a single point of dependency injection for cache keys. In my codebase, it's necessary sometimes to invalidate the cache for a particular model, and overriding this method to append a cache version allows for this functionality.

(On first glance ```cacheable_table_name``` provides this functionality, but it's used for other purposes elsewhere and is therefore unsuitable for dependency injection.)

I've omitted tests in this PR because I'm not the most experienced with RSpec and couldn't figure out a way to test this functionality without duplicating all the specs for this module. This functionality should definitely be tested and I'd welcome suggestions on how to test in a DRY manner.