We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6f7f268 commit 5c0af38Copy full SHA for 5c0af38
3 files changed
lib/ruby_units/cache.rb
@@ -20,6 +20,8 @@ def get(key)
20
# @return [void]
21
def set(key, value)
22
key = key.to_unit.units unless key.is_a?(String)
23
+ return if should_skip_caching?(key)
24
+
25
data[key] = value
26
end
27
@@ -32,5 +34,9 @@ def keys
32
34
def clear
33
35
@data = {}
36
37
38
+ def should_skip_caching?(key)
39
+ keys.include?(key) || key =~ RubyUnits::Unit.special_format_regex
40
+ end
41
42
0 commit comments