Commit c378d20c authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Cache lookup results into hash to prevent repeating same requests to git repo

parent 2c796a17
......@@ -184,8 +184,17 @@ class Repository
end
end
def lookup_cache
@lookup_cache ||= {}
end
def method_missing(m, *args, &block)
raw_repository.send(m, *args, &block)
if m == :lookup && !block_given?
lookup_cache[m] ||= {}
lookup_cache[m][args.join(":")] ||= raw_repository.send(m, *args, &block)
else
raw_repository.send(m, *args, &block)
end
end
def respond_to?(method)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment