Module: SecondLevelCache::ActiveRecord::Associations::BelongsToAssociation
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/second_level_cache/active_record/belongs_to_association.rb
Instance Method Summary collapse
Instance Method Details
#find_target_with_second_level_cache ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/second_level_cache/active_record/belongs_to_association.rb', line 13 def find_target_with_second_level_cache return find_target_without_second_level_cache unless klass.second_level_cache_enabled? cache_record = klass.read_second_level_cache(second_level_cache_key) return cache_record.tap{|record| set_inverse_instance(record)} if cache_record record = find_target_without_second_level_cache record.write_second_level_cache record end |