Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update to use Dalli memcache client

  • Loading branch information...
commit b8e6724d3d1537bcd8f5aacb0273eac5640590fc 1 parent 574db2c
@rwdaigle authored
Showing with 7 additions and 27 deletions.
  1. +1 −0  .env
  2. +1 −1  Gemfile
  3. +2 −2 Gemfile.lock
  4. +0 −19 app.rb
  5. +3 −5 config.ru
View
1  .env
@@ -1,2 +1,3 @@
LANG=en_US.UTF-8
RACK_ENV=development
+MEMCACHE_SERVERS=localhost:11211
View
2  Gemfile
@@ -3,7 +3,7 @@ source "http://rubygems.org"
gem 'thin'
gem 'sinatra'
gem 'rack-cache'
-gem 'memcached'
+gem 'dalli'
group :development, :test do
gem 'foreman'
View
4 Gemfile.lock
@@ -2,11 +2,11 @@ GEM
remote: http://rubygems.org/
specs:
daemons (1.1.3)
+ dalli (1.0.5)
eventmachine (0.12.10)
foreman (0.18.0)
term-ansicolor (~> 1.0.5)
thor (>= 0.13.6)
- memcached (1.2.7)
rack (1.2.2)
rack-cache (1.0.2)
rack (>= 0.4)
@@ -25,8 +25,8 @@ PLATFORMS
ruby
DEPENDENCIES
+ dalli
foreman
- memcached
rack-cache
sinatra
thin
View
19 app.rb
@@ -1,19 +0,0 @@
-require 'sinatra/base'
-require 'memcached'
-require 'rack/cache'
-
-class RackCacheDemoApp < Sinatra::Base
-
- $cache = Memcached.new
-
- use Rack::Cache,
- :verbose => true,
- :metastore => $cache,
- :entitystore => $cache
-
- get "/" do
- cache_control :public, :max_age => 15
- "Cached at #{Time.now.to_s}"
- end
-end
-
View
8 config.ru
@@ -1,18 +1,16 @@
require "rubygems"
require "bundler"
require 'sinatra/base'
-require 'memcached'
+require 'dalli'
require 'rack/cache'
Bundler.setup
class RackCacheDemoApp < Sinatra::Base
- $cache = Memcached.new
-
use Rack::Cache,
:verbose => true,
- :metastore => $cache,
- :entitystore => $cache
+ :metastore => "memcached://#{ENV['MEMCACHE_SERVERS']}",
+ :entitystore => "memcached://#{ENV['MEMCACHE_SERVERS']}"
get "/" do
cache_control :public, :max_age => 15
Please sign in to comment.
Something went wrong with that request. Please try again.