-
-
Save mperham/558145 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
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
And you really should instantiate the Dalli::Client instance in a Sinatra startup block, not on every request.