Skip to content

Commit

Permalink
support namespace for *.tdiary.net
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Apr 6, 2013
1 parent 7f0c9fd commit c5f10da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ gem 'omniauth-github'

# To use redis for CacheIO
# gem 'redis'
# gem 'redis-namespace'

platforms :mri do
# To use CoffeeScript
Expand Down
7 changes: 6 additions & 1 deletion tdiary/io/cache/redis.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'redis'
require 'redis-namespace'
require 'yaml'

module TDiary
Expand Down Expand Up @@ -81,7 +82,11 @@ def cache_key(prefix)
end

def redis
@_client ||= Redis.new
@_client ||= if @tdiary.conf.user_name
Redis::Namespace.new(@tdiary.conf.user_name.to_sym, Redis.new)
else
Redis.new
end
end
end
end
Expand Down

0 comments on commit c5f10da

Please sign in to comment.