changeset 143:8a858aec1905

Stringify the cache key
author nanaya <me@nanaya.pro>
date Wed, 13 Dec 2017 06:09:17 +0900
parents 2d873f57f424
children 1925b08153dc
files app/models/tweet.rb
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/app/models/tweet.rb	Wed Dec 13 04:57:04 2017 +0900
+++ b/app/models/tweet.rb	Wed Dec 13 06:09:17 2017 +0900
@@ -19,7 +19,7 @@
     initial_config_id = client_config_id
 
     @timeline ||=
-      Rails.cache.fetch({ :timeline => @twitter_id }, :expires_in => cache_expires_time) do
+      Rails.cache.fetch("timeline:v1:#{@twitter_id}", :expires_in => cache_expires_time) do
         begin
           timeline = client.user_timeline(@twitter_id, TIMELINE_OPTIONS)
         rescue Twitter::Error::TooManyRequests
@@ -49,7 +49,7 @@
       if timeline.any?
         timeline.first.user
       else
-        Rails.cache.fetch({ :user => @twitter_id }, :expires_in => cache_expires_time) do
+        Rails.cache.fetch("user:v1:#{@twitter_id}", :expires_in => cache_expires_time) do
           client.user(@twitter_id)
         end
       end