diff --git a/lib/liquid/expression.rb b/lib/liquid/expression.rb index f2abb2fc1..f10c25db0 100644 --- a/lib/liquid/expression.rb +++ b/lib/liquid/expression.rb @@ -44,9 +44,7 @@ def parse(markup, ss = StringScanner.new(""), cache = nil) # Cache only exists during parsing if cache - return cache[markup] if cache.key?(markup) - - cache[markup] = inner_parse(markup, ss, cache).freeze + cache.getset(markup) { inner_parse(markup, ss, cache).freeze } else inner_parse(markup, ss, nil).freeze end