changeset 110:f76d44baa3dc

Test adding redis support
author nanaya <me@myconan.net>
date Wed, 09 Nov 2016 07:35:03 +0900
parents e74c23d5c42e
children 3df5fcecdd46
files Gemfile Gemfile.lock README.md config/application.rb config/config_init.rb
diffstat 5 files changed, 29 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/Gemfile	Sun Oct 30 04:27:12 2016 +0900
+++ b/Gemfile	Wed Nov 09 07:35:03 2016 +0900
@@ -5,7 +5,7 @@
 gem "railties", rails_ver
 gem "actionpack", rails_ver
 
-gem "dalli"
+gem "redis-rails"
 
 gem "twitter"
 gem "twitter-text"
--- a/Gemfile.lock	Sun Oct 30 04:27:12 2016 +0900
+++ b/Gemfile.lock	Wed Nov 09 07:35:03 2016 +0900
@@ -19,12 +19,12 @@
       i18n (~> 0.7)
       minitest (~> 5.1)
       tzinfo (~> 1.1)
-    addressable (2.4.0)
+    addressable (2.5.0)
+      public_suffix (~> 2.0, >= 2.0.2)
     buftok (0.2.0)
     builder (3.2.2)
     concurrent-ruby (1.0.2)
     concurrent-ruby (1.0.2-java)
-    dalli (2.7.6)
     domain_name (0.5.20161021)
       unf (>= 0.0.5, < 1.0.0)
     equalizer (0.0.10)
@@ -54,12 +54,13 @@
     minitest (5.9.1)
     multipart-post (2.0.0)
     naught (1.1.0)
-    newrelic_rpm (3.17.0.325)
+    newrelic_rpm (3.17.1.326)
     nokogiri (1.6.8.1)
       mini_portile2 (~> 2.1.0)
     nokogiri (1.6.8.1-java)
     nokogiri (1.6.8.1-x86-mingw32)
       mini_portile2 (~> 2.1.0)
+    public_suffix (2.0.4)
     puma (3.6.0)
     puma (3.6.0-java)
     rack (2.0.1)
@@ -78,6 +79,23 @@
       thor (>= 0.18.1, < 2.0)
     raindrops (0.17.0)
     rake (11.3.0)
+    redis (3.3.1)
+    redis-actionpack (5.0.1)
+      actionpack (>= 4.0, < 6)
+      redis-rack (>= 1, < 3)
+      redis-store (>= 1.1.0, < 1.4.0)
+    redis-activesupport (5.0.1)
+      activesupport (>= 3, < 6)
+      redis-store (~> 1.2.0)
+    redis-rack (2.0.0)
+      rack (~> 2.0)
+      redis-store (~> 1.2.0)
+    redis-rails (5.0.1)
+      redis-actionpack (~> 5.0.0)
+      redis-activesupport (~> 5.0.0)
+      redis-store (~> 1.2.0)
+    redis-store (1.2.0)
+      redis (>= 2.2)
     simple_oauth (0.3.1)
     thor (0.19.1)
     thread_safe (0.3.5)
@@ -93,7 +111,7 @@
       memoizable (~> 0.4.0)
       naught (~> 1.0)
       simple_oauth (~> 0.3.0)
-    twitter-text (1.14.0)
+    twitter-text (1.14.1)
       unf (~> 0.1.0)
     tzinfo (1.2.2)
       thread_safe (~> 0.1)
@@ -102,7 +120,7 @@
     unf (0.1.4-java)
     unf_ext (0.0.7.2)
     unf_ext (0.0.7.2-x86-mingw32)
-    unicorn (5.1.0)
+    unicorn (5.2.0)
       kgio (~> 2.6)
       raindrops (~> 0.7)
 
@@ -114,10 +132,10 @@
 DEPENDENCIES
   actionpack (~> 5.0.0)
   actionview (~> 5.0.0)
-  dalli
   newrelic_rpm
   puma
   railties (~> 5.0.0)
+  redis-rails
   twitter
   twitter-text
   unicorn
--- a/README.md	Sun Oct 30 04:27:12 2016 +0900
+++ b/README.md	Wed Nov 09 07:35:03 2016 +0900
@@ -21,24 +21,7 @@
 Configuration
 -------------
 
-This application depends on at least those two Twitter-related tokens:
-
-- `RT_CONSUMER_KEY`
-- `RT_CONSUMER_SECRET`
-
-Make sure to set them before using.
-
-Optionally, setting those two variables allows you access to private accounts which your account has access to:
-
-- `RT_ACCESS_TOKEN`
-- `RT_ACCESS_TOKEN_SECRET`
-
-It is also recommended to have memcached installed so tweet requests will be cached
-for a short while.
-
-- `RT_MEMCACHED_SERVERS` (separate multiple servers with comma)
-
-Alternatively, create a config file. Read `config/config_init.rb` for hints.
+Create a config file. Read `config/config_init.rb` for hints.
 
 
 To do
--- a/config/application.rb	Sun Oct 30 04:27:12 2016 +0900
+++ b/config/application.rb	Wed Nov 09 07:35:03 2016 +0900
@@ -27,8 +27,8 @@
     config.secret_key_base = "herp a derp"
     config.session_store :disabled
 
-    if $cfg[:memcached_servers]
-      config.cache_store = :mem_cache_store, $cfg[:memcached_servers], { :namespace => "rsstweet" }
+    if $cfg[:redis_server]
+      config.cache_store = :redis_store, "#{$cfg[:redis_server]}/cache_store", { :expires_in => 12.hours }
     end
   end
 end
--- a/config/config_init.rb	Sun Oct 30 04:27:12 2016 +0900
+++ b/config/config_init.rb	Wed Nov 09 07:35:03 2016 +0900
@@ -5,7 +5,7 @@
     :access_token => ENV["RT_ACCESS_TOKEN"],
     :access_token_secret => ENV["RT_ACCESS_TOKEN_SECRET"]
   },
-  :memcached_servers => ENV["RT_MEMCACHED_SERVERS"].try(:split, ",")
+  :redis_server => ENV["RT_REDIS_SERVER"]
 }
 
 config_local = File.expand_path("../config_local_#{Rails.env}.rb", __FILE__)