Permalink
Browse files

using sorted gem list as the cache key to avoid re-computing the resu…

…lts for effectively the same gem list
  • Loading branch information...
1 parent ee21249 commit 718617197b5bebf08ad43857ce63dc60bf1c47b0 @pkmiec pkmiec committed Jun 15, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/geminabox.rb
View
@@ -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 7186171

Please sign in to comment.