Skip to content

Instantly share code, notes, and snippets.

@bennacer860
Created July 6, 2017 01:54
Show Gist options
  • Save bennacer860/18eade85bfd9fce9b644db02bcff3260 to your computer and use it in GitHub Desktop.
Save bennacer860/18eade85bfd9fce9b644db02bcff3260 to your computer and use it in GitHub Desktop.
class Main < Sinatra::Base
get '/' do
# make call to the database
result = number_of_users
"Hello World! #{result[:count]}"
end
def number_of_users
Cache.fetch "number_of_users" do
FakeDatabase.connection "select count(*) from users"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment