Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Commit

Permalink
updated redis client config
Browse files Browse the repository at this point in the history
  • Loading branch information
vaughanbrittonsage committed May 26, 2017
1 parent 03c5ccd commit 987ef76
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
21 changes: 17 additions & 4 deletions cache_store_redis/lib/cache_store_redis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,30 @@
#This class is used for interacting with a redis based cache store.
class RedisCacheStore

def initialize(namespace = nil)
def initialize(namespace = nil, config = nil)
@namespace = namespace
@client = Redis.new
if config == nil
@client = Redis.new
else
@client = Redis.new(config)
end
end

#This method is called to configure the connection to the cache store.
def configure(host = 'localhost', port = 6379, db = 'default', password = nil)
config = { :host => host, :port => port, :db => db }
def configure(host = 'localhost', port = 6379, db = 'default', password = nil, driver: nil, url: nil)
if url != nil
config[:url] = url
config[:db] = db
else
config = { :host => host, :port => port, :db => db }
end
if password != nil
config[:password] = password
end
if driver != nil
config[:driver] = driver
end

@client = Redis.new(config)
end

Expand Down
2 changes: 1 addition & 1 deletion cache_store_redis/lib/cache_store_redis/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module CacheStoreRedis
VERSION = "0.1.0"
VERSION = "0.1.1"
end

0 comments on commit 987ef76

Please sign in to comment.