Skip to content

Instantly share code, notes, and snippets.

@mperham
Forked from zzak/gist:558001
Created August 30, 2010 22:23
Show Gist options
  • Save mperham/558145 to your computer and use it in GitHub Desktop.
Save mperham/558145 to your computer and use it in GitHub Desktop.
get '/' do
dc = Dalli::Client.new('localhost:11211')
@info = dc.fetch("info-#{userid}-#{repoid}") do
HTTParty.get("#{base_uri}/repos/show/#{userid}/#{repoid}"))
end
@collaborators = dc.fetch("collaborators-#{userid}-#{repoid}") do
HTTParty.get("#{base_uri}/repos/show/#{userid}/#{repoid}/collaborators"))
end
@blobs = dc.fetch("blobs-#{userid}-#{repoid}") do
HTTParty.get("#{base_uri}/blob/all/#{userid}/#{repoid}/master"))
end
erb :index
end
@mperham
Copy link
Author

mperham commented Aug 30, 2010

And you really should instantiate the Dalli::Client instance in a Sinatra startup block, not on every request.

@zzak
Copy link

zzak commented Aug 30, 2010

Mike, thanks for taking a look at this.

I really appreciate your improvements to the code and will be adding this to my application, along with a credit to your contribution in the documentation.

Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment