Module: CacheFinder::FindById
- Included in:
- CacheFinder::Finder::Singleton
- Defined in:
- lib/cache_finder/finder/find_by_id.rb
Overview
Will find and cached the entity by it’s id.
Example of using:
Company.cache_find(10)
Will produce the cache accessible by the key:
['Company', 10]
Instance Method Summary collapse
Instance Method Details
#cache_find(id) ⇒ Object
14 15 16 |
# File 'lib/cache_finder/finder/find_by_id.rb', line 14 def cache_find(id) Rails.cache.fetch([self.name, id]) { find(id) } end |