Skip to content
Browse files

Merge pull request #68 from appfolio/caching_improvements

using sorted gem list as the cache key to avoid re-computing the results
  • Loading branch information...
2 parents ee21249 + 7186171 commit f931829d8f87b3a1201ecf8913adc7650f46e2d2 @cwninja committed
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/geminabox.rb
View
5 lib/geminabox.rb
@@ -50,8 +50,9 @@ def fixup_bundler_rubygems!
end
get '/api/v1/dependencies' do
- disk_cache.cache(params[:gems]) do
- query_gems = params[:gems].split(',')
+ query_gems = params[:gems].split(',').sort
+ cache_key = query_gems.join(',')
+ disk_cache.cache(cache_key) do
deps = load_gems.gems.select {|gem| query_gems.include?(gem.name) }.map do |gem|
spec = spec_for(gem.name, gem.number)
{

0 comments on commit f931829

Please sign in to comment.
Something went wrong with that request. Please try again.