Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

redis & memory example rack apps

  • Loading branch information...
commit a016b769464c99157159cf51025d412266eca2c0 1 parent 36f3808
Ilya Grigorik authored
17 examples/memory_runner.rb
View
@@ -0,0 +1,17 @@
+require 'rubygems'
+require 'rack'
+
+$LOAD_PATH.unshift 'lib'
+$LOAD_PATH.unshift 'examples'
+
+require 'rack/speedtracer'
+require 'someapp'
+
+builder = Rack::Builder.new do
+ use Rack::CommonLogger
+ use Rack::SpeedTracer
+
+ run SomeApp.new
+end
+
+Rack::Handler::Thin.run builder.to_app, :Port => 4567
17 examples/redis_runner.rb
View
@@ -0,0 +1,17 @@
+require 'rubygems'
+require 'rack'
+
+$LOAD_PATH.unshift 'lib'
+$LOAD_PATH.unshift 'examples'
+
+require 'rack/speedtracer'
+require 'someapp'
+
+builder = Rack::Builder.new do
+ use Rack::CommonLogger
+ use Rack::SpeedTracer, :storage => Rack::SpeedTracer::Storage::Redis
+
+ run SomeApp.new
+end
+
+Rack::Handler::Thin.run builder.to_app, :Port => 4567
17 examples/runner.rb → examples/someapp.rb
View
@@ -1,9 +1,3 @@
-require 'rubygems'
-require 'rack'
-
-$LOAD_PATH.unshift 'lib'
-require 'rack/speedtracer'
-
class SomeApp
def call(env)
env['st.tracer'].run('computation: 5**100000') do
@@ -22,13 +16,4 @@ def call(env)
[200, {"Content-Type" => "text/plain"}, "Hello World"]
end
-end
-
-builder = Rack::Builder.new do
- use Rack::CommonLogger
- use Rack::SpeedTracer, :storage => :redis
-
- run SomeApp.new
-end
-
-Rack::Handler::Thin.run builder.to_app, :Port => 4567
+end
Please sign in to comment.
Something went wrong with that request. Please try again.