Skip to content

Commit

Permalink
Handled global use_cache option in Measurement
Browse files Browse the repository at this point in the history
  • Loading branch information
shivam091 committed Oct 22, 2023
1 parent 58e2beb commit 9f98827
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/unit_measurements/measurement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@ def unit_from_unit_or_name!(value)
# @author {Harshal V. Ladhe}[https://shivam091.github.io/]
# @since 5.2.0
def calculate_conversion_factor(target_unit, use_cache)
use_cache = (UnitMeasurements.configuration.use_cache || use_cache)

if use_cache && (cached_factor = self.class.cached.get(unit.name, target_unit.name))
cached_factor
else
Expand Down

0 comments on commit 9f98827

Please sign in to comment.